public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Heiko Carstens <heiko.carstens@de.ibm.com>
To: Ameen Ali <ameenali023@gmail.com>
Cc: schwidefsky@de.ibm.com, linux390@de.ibm.com,
	keescook@chromium.org, wsa@the-dreams.de,
	linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] dcssblk.c : Array index 'i' is used before limits check.
Date: Wed, 25 Feb 2015 10:26:31 +0100	[thread overview]
Message-ID: <20150225092631.GA4271@osiris> (raw)
In-Reply-To: <1424796110-7736-1-git-send-email-ameenali023@gmail.com>

On Tue, Feb 24, 2015 at 06:41:50PM +0200, Ameen Ali wrote:
> avoid out-of-bounds-read by checking count before indexing.
> 
> Signed-off-by : Ameen Ali <Ameenali023@gmail.com>
> ---
>  drivers/s390/block/dcssblk.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c
> index 96128cb..da21281 100644
> --- a/drivers/s390/block/dcssblk.c
> +++ b/drivers/s390/block/dcssblk.c
> @@ -547,7 +547,7 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char
>  	 * parse input
>  	 */
>  	num_of_segments = 0;
> -	for (i = 0; ((buf[i] != '\0') && (buf[i] != '\n') && i < count); i++) {
> +	for (i = 0; (i < count && (buf[i] != '\0') && (buf[i] != '\n')); i++) {

Applied, thanks!


  parent reply	other threads:[~2015-02-25  9:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-24 16:41 [PATCH] dcssblk.c : Array index 'i' is used before limits check Ameen Ali
2015-02-24 16:44 ` Kees Cook
2015-02-25  9:26 ` Heiko Carstens [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-02-24 15:57 Ameen Ali
2015-02-24 16:29 ` Kees Cook

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=20150225092631.GA4271@osiris \
    --to=heiko.carstens@de.ibm.com \
    --cc=ameenali023@gmail.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux390@de.ibm.com \
    --cc=schwidefsky@de.ibm.com \
    --cc=wsa@the-dreams.de \
    /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