public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nishanth Menon <nm@ti.com>
To: Axel Lin <axel.lin@ingics.com>
Cc: Mark Brown <broonie@kernel.org>,
	"Andrii.Tseglytskyi" <andrii.tseglytskyi@ti.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] regulator: ti-abb: Fix off-by-one valid range checking for abb->current_info_idx
Date: Sat, 4 May 2013 10:19:23 -0500	[thread overview]
Message-ID: <20130504151752.GA2801@snafu> (raw)
In-Reply-To: <1367676147.5124.1.camel@phoenix>

Change in Liam's email ID.
On 22:02-20130504, Axel Lin wrote:
> abb->current_info_idx is used as array subscript to access volt_table,
> thus the valid value range should be 0 ... desc->n_voltages - 1.
> 
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
>  drivers/regulator/ti-abb-regulator.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/regulator/ti-abb-regulator.c b/drivers/regulator/ti-abb-regulator.c
> index c1870ea..870d209 100644
> --- a/drivers/regulator/ti-abb-regulator.c
> +++ b/drivers/regulator/ti-abb-regulator.c
> @@ -387,8 +387,8 @@ static int ti_abb_get_voltage_sel(struct regulator_dev *rdev)
>  		return -EINVAL;
>  	}
>  
> -	if (abb->current_info_idx > (int)desc->n_voltages) {
> -		dev_err(dev, "%s: Corrupted data? idx(%d) > n_voltages(%d)\n",
> +	if (abb->current_info_idx >= (int)desc->n_voltages) {
> +		dev_err(dev, "%s: Corrupted data? idx(%d) >= n_voltages(%d)\n",
>  			__func__, abb->current_info_idx, desc->n_voltages);
>  		return -EINVAL;
>  	}
> -- 
> 1.8.1.2

Thanks for the same.
Acked-by: Nishanth Menon <nm@ti.com>

-- 
Regards,
Nishanth Menon

  reply	other threads:[~2013-05-04 15:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-04 14:02 [PATCH] regulator: ti-abb: Fix off-by-one valid range checking for abb->current_info_idx Axel Lin
2013-05-04 15:19 ` Nishanth Menon [this message]
2013-05-05 10:23 ` Mark Brown

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=20130504151752.GA2801@snafu \
    --to=nm@ti.com \
    --cc=andrii.tseglytskyi@ti.com \
    --cc=axel.lin@ingics.com \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@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