提交 18378049 编写于 作者: H Heinrich Schuchardt 提交者: Tom Rini

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: c3c86388 ("add FIT data-position & data-offset property support")
Signed-off-by: NHeinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: NSimon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
上级 92a19be2
......@@ -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);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册