From: Marek Vasut <marek.vasut@mailbox.org>
To: Tom Rini <trini@konsulko.com>,
Marek Vasut <marek.vasut+renesas@mailbox.org>
Cc: u-boot@lists.denx.de,
Heinrich Schuchardt <heinrich.schuchardt@canonical.com>,
Michal Simek <michal.simek@amd.com>,
Oleksandr Suvorov <oleksandr.suvorov@foundries.io>,
Simon Glass <sjg@chromium.org>, Stefan Roese <sr@denx.de>
Subject: Re: [PATCH] image: Fix potentially uninitialized data variable
Date: Thu, 2 Mar 2023 04:18:14 +0100 [thread overview]
Message-ID: <3f3196e4-3fd3-5ba6-3c90-eb8436b3773a@mailbox.org> (raw)
In-Reply-To: <Y/93Dj3R81OTO/y1@bill-the-cat>
On 3/1/23 17:02, Tom Rini wrote:
> On Mon, Feb 27, 2023 at 08:56:31PM +0100, Marek Vasut wrote:
>
>> 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 <marek.vasut+renesas@mailbox.org>
>
> Reviewed-by: Tom Rini <trini@konsulko.com>
>
> And can you please do a follow-up that adds sandbox64 + clang, after the
> sandbox + clang test in GitLab/Azure?
The CI is chewing on it here:
ahttps://source.denx.de/u-boot/custodians/u-boot-sh/-/commit/f80a434c2ea4fdae7adf0e4c4a0ecd9784d6808e
next prev parent reply other threads:[~2023-03-02 3:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-27 19:56 [PATCH] image: Fix potentially uninitialized data variable Marek Vasut
2023-03-01 16:02 ` Tom Rini
2023-03-02 3:18 ` Marek Vasut [this message]
2023-03-01 23:38 ` Simon Glass
2023-03-31 14:16 ` Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3f3196e4-3fd3-5ba6-3c90-eb8436b3773a@mailbox.org \
--to=marek.vasut@mailbox.org \
--cc=heinrich.schuchardt@canonical.com \
--cc=marek.vasut+renesas@mailbox.org \
--cc=michal.simek@amd.com \
--cc=oleksandr.suvorov@foundries.io \
--cc=sjg@chromium.org \
--cc=sr@denx.de \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox