On 19.07.21 14:20, Marek Behún wrote:
From: Pali Rohár <[email protected]>

Function image_version() returns unsigned value, so it can never be
negative. Explicitly check for two supported image versions: v0 and v1.

Signed-off-by: Pali Rohár <[email protected]>
Reviewed-by: Marek Behún <[email protected]>

Reviewed-by: Stefan Roese <[email protected]>

Thanks,
Stefan

---
  tools/kwboot.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/kwboot.c b/tools/kwboot.c
index 1d32c1b7ad..7feeaa45a2 100644
--- a/tools/kwboot.c
+++ b/tools/kwboot.c
@@ -634,7 +634,7 @@ kwboot_img_patch_hdr(void *img, size_t size)
        }
image_ver = image_version(img);
-       if (image_ver < 0) {
+       if (image_ver != 0 && image_ver != 1) {
                fprintf(stderr, "Invalid image header version\n");
                errno = EINVAL;
                goto out;



Viele Grüße,
Stefan

--
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: [email protected]

Reply via email to