public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Liam Girdwood <lrg@slimlogic.co.uk>
To: Axel Lin <axel.lin@gmail.com>
Cc: linux-kernel@vger.kernel.org, Yong Shen <yong.shen@linaro.org>,
	Mark Brown <broonie@opensource.wolfsonmicro.com>
Subject: Re: [PATCH] regulator: Fix off-by-one value range checking for mc13xxx_regulator_get_voltage
Date: Sat, 21 May 2011 12:54:02 +0100	[thread overview]
Message-ID: <1305978842.3317.8.camel@odin> (raw)
In-Reply-To: <1305723405.6172.1.camel@phoenix>

On Wed, 2011-05-18 at 20:56 +0800, Axel Lin wrote:
> We use val as array index,
> thus the valid value rangae for val should be 0 .. n_voltages-1.
> 
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
> ---
>  drivers/regulator/mc13xxx-regulator-core.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/regulator/mc13xxx-regulator-core.c b/drivers/regulator/mc13xxx-regulator-core.c
> index 2bb5de1..bc27ab1 100644
> --- a/drivers/regulator/mc13xxx-regulator-core.c
> +++ b/drivers/regulator/mc13xxx-regulator-core.c
> @@ -174,7 +174,7 @@ static int mc13xxx_regulator_get_voltage(struct regulator_dev *rdev)
>  
>  	dev_dbg(rdev_get_dev(rdev), "%s id: %d val: %d\n", __func__, id, val);
>  
> -	BUG_ON(val > mc13xxx_regulators[id].desc.n_voltages);
> +	BUG_ON(val >= mc13xxx_regulators[id].desc.n_voltages);
>  
>  	return mc13xxx_regulators[id].voltages[val];
>  }

Applied

Thanks

Liam


      parent reply	other threads:[~2011-05-21 11:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-18 12:56 [PATCH] regulator: Fix off-by-one value range checking for mc13xxx_regulator_get_voltage Axel Lin
2011-05-18 16:30 ` Mark Brown
2011-05-21 11:54 ` Liam Girdwood [this message]

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=1305978842.3317.8.camel@odin \
    --to=lrg@slimlogic.co.uk \
    --cc=axel.lin@gmail.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yong.shen@linaro.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