From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: Roel Kluin <roel.kluin@gmail.com>
Cc: jgarzik@pobox.com, linux-ide@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] libata: Read buffer overflow
Date: Mon, 03 Aug 2009 09:37:14 -0500 [thread overview]
Message-ID: <1249310234.3943.13.camel@mulgrave.site> (raw)
In-Reply-To: <4A76CA64.60802@gmail.com>
On Mon, 2009-08-03 at 13:30 +0200, Roel Kluin wrote:
> Check whether index is within bounds before grabbing the element.
This isn't a correct description or analysis.
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
> diff --git a/drivers/ata/pata_mpc52xx.c b/drivers/ata/pata_mpc52xx.c
> index 2bc2dbe..f88c2ff 100644
> --- a/drivers/ata/pata_mpc52xx.c
> +++ b/drivers/ata/pata_mpc52xx.c
> @@ -294,10 +294,11 @@ mpc52xx_ata_compute_mdma_timings(struct mpc52xx_ata_priv *priv, int dev,
> int speed)
> {
> struct mpc52xx_ata_timings *t = &priv->timings[dev];
> - const struct mdmaspec *s = &priv->mdmaspec[speed];
This is a *pointer* to the element, *not* a dereference. It's
irrelevant whether the pointer is off the end of the array or not
> + const struct mdmaspec *s;
>
> if (speed < 0 || speed > 2)
> return -EINVAL;
And since the check is immediately after, the pointer is never
dereferenced.
> + s = &priv->mdmaspec[speed];
James
prev parent reply other threads:[~2009-08-03 14:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-03 11:30 [PATCH] libata: Read buffer overflow Roel Kluin
2009-08-03 14:37 ` James Bottomley [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=1249310234.3943.13.camel@mulgrave.site \
--to=james.bottomley@hansenpartnership.com \
--cc=akpm@linux-foundation.org \
--cc=jgarzik@pobox.com \
--cc=linux-ide@vger.kernel.org \
--cc=roel.kluin@gmail.com \
/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