From: Nathan Chancellor <nathan@kernel.org>
To: Alexey Kardashevskiy <aik@ozlabs.ru>
Cc: Leonardo Bras <leobras.c@gmail.com>,
Andrew Donnellan <ajd@linux.ibm.com>,
llvm@lists.linux.dev,
Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com>,
Frederic Barrat <fbarrat@linux.ibm.com>,
linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH kernel v2] pseries/iommu/ddw: Fix kdump to work in absence of ibm,dma-window
Date: Mon, 8 Aug 2022 09:48:55 -0700 [thread overview]
Message-ID: <YvE+d7xcB77GODjc@dev-arch.thelio-3990X> (raw)
In-Reply-To: <20220629060614.1680476-1-aik@ozlabs.ru>
Hi Alexey,
This change is now in mainline as commit b1fc44eaa9ba
("pseries/iommu/ddw: Fix kdump to work in absence of ibm,dma-window").
> diff --git a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec/file_load_64.c
> index b4981b651d9a..5d2c22aa34fb 100644
> --- a/arch/powerpc/kexec/file_load_64.c
> +++ b/arch/powerpc/kexec/file_load_64.c
> @@ -1038,6 +1038,48 @@ static int update_cpus_node(void *fdt)
> return ret;
> }
>
> +static int copy_property(void *fdt, int node_offset, const struct device_node *dn,
> + const char *propname)
> +{
> + const void *prop, *fdtprop;
> + int len = 0, fdtlen = 0, ret;
> +
> + prop = of_get_property(dn, propname, &len);
> + fdtprop = fdt_getprop(fdt, node_offset, propname, &fdtlen);
> +
> + if (fdtprop && !prop)
> + ret = fdt_delprop(fdt, node_offset, propname);
> + else if (prop)
> + ret = fdt_setprop(fdt, node_offset, propname, prop, len);
> +
> + return ret;
> +}
clang now warns/errors:
arch/powerpc/kexec/file_load_64.c:1053:11: error: variable 'ret' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
else if (prop)
^~~~
arch/powerpc/kexec/file_load_64.c:1056:9: note: uninitialized use occurs here
return ret;
^~~
arch/powerpc/kexec/file_load_64.c:1053:7: note: remove the 'if' if its condition is always true
else if (prop)
^~~~~~~~~
arch/powerpc/kexec/file_load_64.c:1046:30: note: initialize the variable 'ret' to silence this warning
int len = 0, fdtlen = 0, ret;
^
= 0
1 error generated.
Is !fdtprop && !prop a concern? What should a sensible default for ret
be?
Cheers,
Nathan
prev parent reply other threads:[~2022-08-08 16:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-29 6:06 [PATCH kernel v2] pseries/iommu/ddw: Fix kdump to work in absence of ibm,dma-window Alexey Kardashevskiy
2022-07-14 7:59 ` Hari Bathini
2022-07-29 13:02 ` Michael Ellerman
2022-08-08 16:48 ` Nathan Chancellor [this message]
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=YvE+d7xcB77GODjc@dev-arch.thelio-3990X \
--to=nathan@kernel.org \
--cc=aik@ozlabs.ru \
--cc=ajd@linux.ibm.com \
--cc=bauerman@linux.vnet.ibm.com \
--cc=fbarrat@linux.ibm.com \
--cc=leobras.c@gmail.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=llvm@lists.linux.dev \
/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