All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Russell Currey <ruscur@russell.cc>
Cc: aik@ozlabs.ru, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v2] powerpc/kexec: Fix build failure from uninitialised variable
Date: Wed, 10 Aug 2022 09:43:34 -0700	[thread overview]
Message-ID: <YvPgNsl1RalFdPH+@dev-arch.thelio-3990X> (raw)
In-Reply-To: <20220810054331.373761-1-ruscur@russell.cc>

On Wed, Aug 10, 2022 at 03:43:31PM +1000, Russell Currey wrote:
> clang 14 won't build because ret is uninitialised and can be returned if
> both prop and fdtprop are NULL.  Drop the ret variable and return an
> error in that failure case.
> 
> Fixes: b1fc44eaa9ba ("pseries/iommu/ddw: Fix kdump to work in absence of ibm,dma-window")
> Suggested-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> Signed-off-by: Russell Currey <ruscur@russell.cc>

Reviewed-by: Nathan Chancellor <nathan@kernel.org>

Thanks for the patch!

> ---
> v2: adopt Christophe's suggestion, which is better
> 
>  arch/powerpc/kexec/file_load_64.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec/file_load_64.c
> index 683462e4556b..349a781cea0b 100644
> --- a/arch/powerpc/kexec/file_load_64.c
> +++ b/arch/powerpc/kexec/file_load_64.c
> @@ -1043,17 +1043,17 @@ static int copy_property(void *fdt, int node_offset, const struct device_node *d
>  			 const char *propname)
>  {
>  	const void *prop, *fdtprop;
> -	int len = 0, fdtlen = 0, ret;
> +	int len = 0, fdtlen = 0;
>  
>  	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);
> +		return fdt_delprop(fdt, node_offset, propname);
>  	else if (prop)
> -		ret = fdt_setprop(fdt, node_offset, propname, prop, len);
> -
> -	return ret;
> +		return fdt_setprop(fdt, node_offset, propname, prop, len);
> +	else
> +		return -FDT_ERR_NOTFOUND;
>  }
>  
>  static int update_pci_dma_nodes(void *fdt, const char *dmapropname)
> -- 
> 2.37.1
> 

  reply	other threads:[~2022-08-10 16:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-10  5:43 [PATCH v2] powerpc/kexec: Fix build failure from uninitialised variable Russell Currey
2022-08-10 16:43 ` Nathan Chancellor [this message]
2022-08-13 22:38 ` Michael Ellerman

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=YvPgNsl1RalFdPH+@dev-arch.thelio-3990X \
    --to=nathan@kernel.org \
    --cc=aik@ozlabs.ru \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=ruscur@russell.cc \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.