Re: [patch] mfd: 64 bit bug in bxtwc_val_store()

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

 



I will fix the subject line for this patch, but in future please use
the format akin to the individual subsystem.

In the MFD case this is:

  mfd: <device>: <Summary starting with an uppercase character>

> The call to kstrtoul() will corrupt memory on 64 bit systems because an
> int is 4 bytes and a long is 8.
> 
> Also it's not a good idea to let users trigger a dev_err() because it
> just ends up flooding /var/log/messages so I removed the printk.
> 
> Fixes: 2ddd2086ea9c ('mfd: add Intel Broxton Whiskey Cove PMIC driver')
> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

Applied, thanks.

> diff --git a/drivers/mfd/intel_soc_pmic_bxtwc.c b/drivers/mfd/intel_soc_pmic_bxtwc.c
> index 40acaff..b942876 100644
> --- a/drivers/mfd/intel_soc_pmic_bxtwc.c
> +++ b/drivers/mfd/intel_soc_pmic_bxtwc.c
> @@ -297,10 +297,9 @@ static ssize_t bxtwc_val_store(struct device *dev,
>  	unsigned int val;
>  	struct intel_soc_pmic *pmic = dev_get_drvdata(dev);
>  
> -	if (kstrtoul(buf, 0, (unsigned long *)&val)) {
> -		dev_err(dev, "Invalid register value\n");
> -		return -EINVAL;
> -	}
> +	ret = kstrtouint(buf, 0, &val);
> +	if (ret)
> +		return ret;
>  
>  	ret = regmap_write(pmic->regmap, bxtwc_reg_addr, val);
>  	if (ret) {

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux