]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
tools: kwbimage: Check for maximal kwbimage header size
authorPali Rohár <pali@kernel.org>
Wed, 12 Jan 2022 17:20:43 +0000 (18:20 +0100)
committerStefan Roese <sr@denx.de>
Fri, 14 Jan 2022 10:39:16 +0000 (11:39 +0100)
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>
tools/kwbimage.c

index a5b518f60bc8208c72206a989c7c52272faabf07..ce053a4a5a78febeeb6cf28624186356979bc770 100644 (file)
@@ -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: