]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
fdt: Check error codes returned from fdtlib when loading ITB
authorJoe Hershberger <joe.hershberger@ni.com>
Fri, 17 Aug 2012 10:34:35 +0000 (10:34 +0000)
committerGerald Van Baren <gvb@unssw.com>
Mon, 15 Oct 2012 23:20:08 +0000 (19:20 -0400)
Before this patch, error codes returned from fdtlib were ignored and
continued access would cause a crash. Now just check if the image is
truncated and error if so.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
common/image.c

index f084d2baed3e0685937c6d4be3b73eb8e54add3a..852a96fab8b89b0c9b59ed9d0b606c814180d6c1 100644 (file)
@@ -2820,6 +2820,11 @@ int fit_image_check_hashes(const void *fit, int image_noffset)
                }
        }
 
+       if (noffset == -FDT_ERR_TRUNCATED || noffset == -FDT_ERR_BADSTRUCTURE) {
+               err_msg = " error!\nCorrupted or truncated tree";
+               goto error;
+       }
+
        return 1;
 
 error: