Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
* Re: [PATCH kernel v2] pseries/iommu/ddw: Fix kdump to work in absence of ibm,dma-window
       [not found] <20220629060614.1680476-1-aik@ozlabs.ru>
@ 2022-08-08 16:48 ` Nathan Chancellor
  0 siblings, 0 replies; only message in thread
From: Nathan Chancellor @ 2022-08-08 16:48 UTC (permalink / raw)
  To: Alexey Kardashevskiy
  Cc: linuxppc-dev, Leonardo Bras, Andrew Donnellan, Frederic Barrat,
	Thiago Jung Bauermann, llvm

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-08-08 16:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20220629060614.1680476-1-aik@ozlabs.ru>
2022-08-08 16:48 ` [PATCH kernel v2] pseries/iommu/ddw: Fix kdump to work in absence of ibm,dma-window Nathan Chancellor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox