diff options
| author | Marek Vasut <[email protected]> | 2023-02-27 20:56:31 +0100 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2023-03-30 15:09:58 -0400 |
| commit | 771cb4d58b236902c319f037c967fd7a01cbf00a (patch) | |
| tree | 2351801725725172c0e4d71506b66f790b9b448a /api | |
| parent | 00491a30b1a4170b6cdd8f563828b6a55cd6e510 (diff) | |
image: Fix potentially uninitialized data variable
In case fitImage support is disabled, and image_locate_script() is
passed a fitImage, then the 'data' variable is used uninitialized.
Drop into the default: branch of the switch-case statement and do
not return the uninitialized data, and do not modify the return
pointer either, just print an error message.
Reported by clang build:
"
$ make HOSTCC=clang CC=clang KCFLAGS=-Werror sandbox64_defconfig && make HOSTCC=clang CC=clang KCFLAGS=-Werror
...
boot/image-board.c:1006:7: error: variable 'data' is used uninitialized whenever switch case is taken [-Werror,-Wsometimes-uninitialized]
case IMAGE_FORMAT_LEGACY:
^~~~~~~~~~~~~~~~~~~
include/image.h:608:29: note: expanded from macro 'IMAGE_FORMAT_LEGACY'
^~~~
boot/image-board.c:1128:19: note: uninitialized use occurs here
*datap = (char *)data;
^~~~
boot/image-board.c:1001:11: note: initialize the variable 'data' to silence this warning
u32 *data;
^
= NULL
"
Signed-off-by: Marek Vasut <[email protected]>
Reviewed-by: Tom Rini <[email protected]>
Reviewed-by: Simon Glass <[email protected]>
Diffstat (limited to 'api')
0 files changed, 0 insertions, 0 deletions
