From: Pali Rohár Date: Wed, 12 Jan 2022 17:20:43 +0000 (+0100) Subject: tools: kwbimage: Check for maximal kwbimage header size X-Git-Url: http://git.dujemihanovic.xyz/img/sics.gif?a=commitdiff_plain;h=78d997f98bc049bf62c8f4c3e39a30fdbdef2fd8;p=u-boot.git 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 Reviewed-by: Stefan Roese --- diff --git a/tools/kwbimage.c b/tools/kwbimage.c index a5b518f60b..ce053a4a5a 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: