From: Heinrich Schuchardt Date: Wed, 11 Mar 2020 20:51:08 +0000 (+0100) Subject: fit: check return value of fit_image_get_data_size() X-Git-Url: http://git.dujemihanovic.xyz/login.html?a=commitdiff_plain;h=183780491f9b45da6bec9627304b2c26169e8801;p=u-boot.git fit: check return value of fit_image_get_data_size() GCC-10 reports: In file included from tools/common/image-fit.c:1: include/image.h: In function ‘fit_image_get_data_and_size’: ./tools/../common/image-fit.c:1015:9: warning: ‘len’ may be used uninitialized in this function [-Wmaybe-uninitialized] 1015 | *size = len; | ~~~~~~^~~~~ ./tools/../common/image-fit.c:996:6: note: ‘len’ was declared here 996 | int len; | ^~~ Add the missing check of the return value of fit_image_get_data_size(). Fixes: c3c863880479 ("add FIT data-position & data-offset property support") Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Goldschmidt --- diff --git a/common/image-fit.c b/common/image-fit.c index f3bb00c98a..4435bc4f1d 100644 --- a/common/image-fit.c +++ b/common/image-fit.c @@ -1011,8 +1011,10 @@ int fit_image_get_data_and_size(const void *fit, int noffset, if (external_data) { debug("External Data\n"); ret = fit_image_get_data_size(fit, noffset, &len); - *data = fit + offset; - *size = len; + if (!ret) { + *data = fit + offset; + *size = len; + } } else { ret = fit_image_get_data(fit, noffset, data, size); }