From patchwork Fri Aug 17 20:34:35 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [U-Boot, 1/6] fdt: Check error codes returned from fdtlib when loading ITB Date: Fri, 17 Aug 2012 10:34:35 -0000 From: Joe Hershberger X-Patchwork-Id: 178360 Message-Id: <1345235680-16419-1-git-send-email-joe.hershberger@ni.com> To: u-boot@lists.denx.de Cc: Joe Hershberger , Jerry Van Baren 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 --- common/image.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common/image.c b/common/image.c index 91954ac..4252e63 100644 --- a/common/image.c +++ b/common/image.c @@ -2818,6 +2818,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: