[PATCH 1/1] cmd: upl: initialize unit test state
Simon Glass
sjg at chromium.org
Tue Nov 5 16:12:31 CET 2024
Hi Heinrich,
On Sat, 2 Nov 2024 at 08:30, Heinrich Schuchardt
<heinrich.schuchardt at canonical.com> wrote:
>
> do_upl_write() calls upl_get_test_data() which may increment the fail
> count in the unit test state. We should initialize it.
>
> Addresses-Coverity-ID: 510465 Uninitialized scalar variable
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
> ---
> cmd/upl.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/cmd/upl.c b/cmd/upl.c
> index 4996f36c787..c9a823bbc06 100644
> --- a/cmd/upl.c
> +++ b/cmd/upl.c
> @@ -50,7 +50,7 @@ static int do_upl_write(struct cmd_tbl *cmdtp, int flag, int argc,
> char *const argv[])
> {
> struct upl s_upl, *upl = &s_upl;
> - struct unit_test_state uts;
> + struct unit_test_state uts = { 0 };
> struct abuf buf;
> oftree tree;
> ulong addr;
> --
> 2.45.2
>
This already exists. A memset() is in upl_init() which is called from
this function.
Regards,
Simon
More information about the U-Boot
mailing list