fit: check return value of fit_image_get_data_size()
PATCH 1/1 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().
--- common/image-fit.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
common/image-fit.c +4 -2
@@ -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); }
--
2.25.1
PATCH 1/1 fit: check return value of fit_image_get_data_size()
Quoted 13 lines · Heinrich Schuchardt
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; | ^~~
Quoted 4 lines
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 <[email protected]>
Quoted 24 lines
--- common/image-fit.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)common/image-fit.c +4
-3@@ -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); } --2.25.1
PATCH 1/1 fit: check return value of fit_image_get_data_size()
In reply to Heinrich SchuchardtQuoted 12 lines · Heinrich Schuchardt
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; | ^~~
Quoted 5 lines
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 <[email protected]>Reviewed-by Simon Goldschmidt <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200313/03e6a166/attachment.sig>