aboutsummaryrefslogtreecommitdiff
path: root/tools/kwbimage.c
diff options
context:
space:
mode:
authorPali Rohár2022-01-12 18:20:43 +0100
committerStefan Roese2022-01-14 11:39:16 +0100
commit78d997f98bc049bf62c8f4c3e39a30fdbdef2fd8 (patch)
tree4083d553600592efe0e83b7c6bb8cfd76e0ef66b /tools/kwbimage.c
parent252e7c3a24fefdf88dfa3fff87e8dc4d0c7aa9cc (diff)
tools: kwbimage: Check for maximal kwbimage header size
BootROM loads kwbimage header to L2-SRAM and BootROM reserve only 192 kB for it. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'tools/kwbimage.c')
-rw-r--r--tools/kwbimage.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/kwbimage.c b/tools/kwbimage.c
index a5b518f60bc..ce053a4a5a7 100644
--- a/tools/kwbimage.c
+++ b/tools/kwbimage.c
@@ -2033,6 +2033,11 @@ static int kwbimage_generate(struct image_tool_params *params,
free(image_cfg);
exit(EXIT_FAILURE);
}
+ if (alloc_len > 192*1024) {
+ fprintf(stderr, "Header is too big (%u bytes), maximal kwbimage header size is %u bytes\n", alloc_len, 192*1024);
+ free(image_cfg);
+ exit(EXIT_FAILURE);
+ }
break;
default: