Re: [PATCH] spi: pl022: don't use uninitialized variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 06, 2017 at 10:16:23AM +0200, Rabin Vincent wrote:
> From: Rabin Vincent <rabinv@xxxxxxxx>
> 
> The num-cs property is a required property according to the binding
> documentation.  However, if it is not present, the driver currently
> simply uses random junk from the stack for the num-cs since the variable
> whose pointer is passed to of_property_read_u32() is not initialized.

> @@ -2074,7 +2074,7 @@ pl022_platform_data_dt_get(struct device *dev)
>  {
>  	struct device_node *np = dev->of_node;
>  	struct pl022_ssp_controller *pd;
> -	u32 tmp;
> +	u32 tmp = 0;
>  
>  	if (!np) {
>  		dev_err(dev, "no dt node defined\n");

This shuts the warning up but since it's a required property shouldn't
we be failing the probe instead of using the value?  Looking at the code
we end up actually doing that since we end up with zero chipselects
which is flagged as an error during the main probe but it'd be good to
note this in the changelog since it looks like we just silently ignore
the required property.

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux