kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: kernel-janitors@vger.kernel.org
Subject: Re: [patch] mfd: 64 bit bug in bxtwc_val_store()
Date: Thu, 01 Oct 2015 11:51:00 +0000	[thread overview]
Message-ID: <20151001115100.GR3214@x1> (raw)
In-Reply-To: <20150928095636.GB11367@mwanda>

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@oracle.com>

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@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2015-10-01 11:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-28  9:56 [patch] mfd: 64 bit bug in bxtwc_val_store() Dan Carpenter
2015-10-01 11:51 ` Lee Jones [this message]
2015-10-01 15:13 ` Dan Carpenter
2015-10-01 15:16 ` Dan Carpenter
2015-10-01 15:23 ` Lee Jones
2015-10-01 15:35 ` Dan Carpenter

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=20151001115100.GR3214@x1 \
    --to=lee.jones@linaro.org \
    --cc=kernel-janitors@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).