From: Joe Hershberger Date: Fri, 17 Aug 2012 10:34:35 +0000 (+0000) Subject: fdt: Check error codes returned from fdtlib when loading ITB X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=367e12597617b2581eb72b3676c6cb86822268b5;p=u-boot.git fdt: Check error codes returned from fdtlib when loading ITB 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 --- diff --git a/common/image.c b/common/image.c index f084d2baed..852a96fab8 100644 --- a/common/image.c +++ b/common/image.c @@ -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: