On 1/12/22 18:20, Pali Rohár wrote:
BootROM loads kwbimage header to L2-SRAM and BootROM reserve only 192 kB for it.

Signed-off-by: Pali Rohár <p...@kernel.org>
---
  tools/kwbimage.c | 5 +++++
  1 file changed, 5 insertions(+)

diff --git a/tools/kwbimage.c b/tools/kwbimage.c
index a5b518f60bc8..ce053a4a5a78 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);
+               }

Nitpicking: Doesn't checkpatch.pl complain about the missing space
around '*'? And wouldn't it be better, to add a macro for this
'192 * 1024', as you are using it twice here already?

Other than this:

Reviewed-by: Stefan Roese <s...@denx.de>

Thanks,
Stefan

                break;
default:


Viele Grüße,
Stefan Roese

--
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: s...@denx.de

Reply via email to