From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: Roel Kluin <roel.kluin@gmail.com>
Cc: kyle@mcmartin.ca, deller@gmx.de, linux-parisc@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] kobject: Read buffer overflow
Date: Sun, 02 Aug 2009 23:33:47 +0000 [thread overview]
Message-ID: <1249256027.3922.218.camel@mulgrave.site> (raw)
In-Reply-To: <4A754814.50506@gmail.com>
On Sun, 2009-08-02 at 10:02 +0200, Roel Kluin wrote:
> Check whether index is within bounds before testing the element.
>
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
> This also removes the likely, should it be kept?
>
> diff --git a/drivers/parisc/pdc_stable.c b/drivers/parisc/pdc_stable.c
> index f9f9a5f..13a64bc 100644
> --- a/drivers/parisc/pdc_stable.c
> +++ b/drivers/parisc/pdc_stable.c
> @@ -370,7 +370,7 @@ pdcspath_layer_read(struct pdcspath_entry *entry, char *buf)
> if (!i) /* entry is not ready */
> return -ENODATA;
>
> - for (i = 0; devpath->layers[i] && (likely(i < 6)); i++)
> + for (i = 0; i < 6 && devpath->layers[i]; i++)
Since all patterns like this (swapping the order of conditions with no
side effects in a for loop condition) are basically trivial, shouldn't
they be going via Jiri Kosina (trivial tree)?
James
prev parent reply other threads:[~2009-08-02 23:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-02 8:02 [PATCH] kobject: Read buffer overflow Roel Kluin
2009-08-02 10:06 ` Thibaut VARENE
2009-08-02 10:16 ` Matthew Wilcox
2009-08-02 10:24 ` Thibaut VARENE
2009-08-02 23:33 ` 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=1249256027.3922.218.camel@mulgrave.site \
--to=james.bottomley@hansenpartnership.com \
--cc=akpm@linux-foundation.org \
--cc=deller@gmx.de \
--cc=kyle@mcmartin.ca \
--cc=linux-parisc@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