public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Artem Bityutskiy <dedekind@infradead.org>
To: Jesper Juhl <jesper.juhl@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>,
	linux-mtd@lists.infradead.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] UBI: Don't use signed int as array index before testing if it is negative
Date: Sat, 04 Aug 2007 12:16:22 +0300	[thread overview]
Message-ID: <1186218982.26902.47.camel@sauron> (raw)
In-Reply-To: <200708040125.26861.jesper.juhl@gmail.com>

On Sat, 2007-08-04 at 01:25 +0200, Jesper Juhl wrote:
> Hi,
> 
> I can't find anything guaranteeing that 'ubi_num' cannot be <0 in 
> drivers/mtd/ubi/kapi.c::ubi_open_volume(), and in fact the code 
> even tests for that and errors out if so. Unfortunately the test 
> for "ubi_num < 0" happens after we've already used 'ubi_num' as 
> an array index - bad thing to do if it is negative.
> This patch moves the test earlier in the function and then moves 
> the indexing using that variable after the check. A bit safer :-) 
> 
> 
> Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>

Thanks for the catch, committed to UBI git tree.

-- 
Best regards,
Artem Bityutskiy (Битюцкий Артём)

      reply	other threads:[~2007-08-04  9:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-03 23:25 [PATCH] UBI: Don't use signed int as array index before testing if it is negative Jesper Juhl
2007-08-04  9:16 ` Artem Bityutskiy [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=1186218982.26902.47.camel@sauron \
    --to=dedekind@infradead.org \
    --cc=dwmw2@infradead.org \
    --cc=jesper.juhl@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.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