* [PATCH 1/1] fit: check return value of fit_image_get_data_size()
@ 2020-03-11 20:51 Heinrich Schuchardt
2020-03-11 20:57 ` Simon Goldschmidt
2020-03-13 17:25 ` Tom Rini
0 siblings, 2 replies; 3+ messages in thread
From: Heinrich Schuchardt @ 2020-03-11 20:51 UTC (permalink / raw)
To: u-boot
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 <xypron.glpk@gmx.de>
---
common/image-fit.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
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);
}
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 1/1] fit: check return value of fit_image_get_data_size()
2020-03-11 20:51 [PATCH 1/1] fit: check return value of fit_image_get_data_size() Heinrich Schuchardt
@ 2020-03-11 20:57 ` Simon Goldschmidt
2020-03-13 17:25 ` Tom Rini
1 sibling, 0 replies; 3+ messages in thread
From: Simon Goldschmidt @ 2020-03-11 20:57 UTC (permalink / raw)
To: u-boot
On Wed, Mar 11, 2020 at 9:51 PM Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>
> 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 <xypron.glpk@gmx.de>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
> ---
> common/image-fit.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> 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);
> }
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/1] fit: check return value of fit_image_get_data_size()
2020-03-11 20:51 [PATCH 1/1] fit: check return value of fit_image_get_data_size() Heinrich Schuchardt
2020-03-11 20:57 ` Simon Goldschmidt
@ 2020-03-13 17:25 ` Tom Rini
1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2020-03-13 17:25 UTC (permalink / raw)
To: u-boot
On Wed, Mar 11, 2020 at 09:51:08PM +0100, Heinrich Schuchardt wrote:
> 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 <xypron.glpk@gmx.de>
> Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Applied to u-boot/master, thanks!
--
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>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-03-13 17:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-11 20:51 [PATCH 1/1] fit: check return value of fit_image_get_data_size() Heinrich Schuchardt
2020-03-11 20:57 ` Simon Goldschmidt
2020-03-13 17:25 ` Tom Rini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.