Welcome to Soft32 Linux Forums!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

[PATCH] UBI: Ensure index is positive

 
   Soft32 Home -> Linux -> Kernel RSS
Next:  [PATCH] strstrip incorrectly marked __must_check  
Author Message
Roel Kluin

External


Since: Dec 02, 2008
Posts: 52



(Msg. 1) Posted: Tue Nov 03, 2009 3:20 pm
Post subject: [PATCH] UBI: Ensure index is positive
Archived from groups: linux>kernel (more info?)

The index is signed, make sure it is not negative
when we read the array element.

Signed-off-by: Roel Kluin <roel.kluin.DeleteThis@gmail.com>
---
drivers/mtd/mtdcore.c | 2 +-
drivers/mtd/nand/fsl_upm.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index 467a4f1..c356c0a 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -447,7 +447,7 @@ struct mtd_info *get_mtd_device(struct mtd_info *mtd, int num)
for (i=0; i< MAX_MTD_DEVICES; i++)
if (mtd_table[i] == mtd)
ret = mtd_table[i];
- } else if (num < MAX_MTD_DEVICES) {
+ } else if (num >= 0 && num < MAX_MTD_DEVICES) {
ret = mtd_table[num];
if (mtd && mtd != ret)
ret = NULL;
diff --git a/drivers/mtd/nand/fsl_upm.c b/drivers/mtd/nand/fsl_upm.c
index d120cd8..071a60c 100644
--- a/drivers/mtd/nand/fsl_upm.c
+++ b/drivers/mtd/nand/fsl_upm.c
@@ -112,7 +112,7 @@ static void fun_select_chip(struct mtd_info *mtd, int mchip_nr)

if (mchip_nr == -1) {
chip->cmd_ctrl(mtd, NAND_CMD_NONE, 0 | NAND_CTRL_CHANGE);
- } else if (mchip_nr >= 0) {
+ } else if (mchip_nr >= 0 && mchip_nr < NAND_MAX_CHIPS) {
fun->mchip_number = mchip_nr;
chip->IO_ADDR_R = fun->io_base + fun->mchip_offsets[mchip_nr];
chip->IO_ADDR_W = chip->IO_ADDR_R;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.DeleteThis@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Artem Bityutskiy

External


Since: Jun 14, 2009
Posts: 9



(Msg. 2) Posted: Wed Nov 11, 2009 3:20 am
Post subject: Re: [PATCH] UBI: Ensure index is positive [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Tue, 2009-11-03 at 20:49 +0100, Roel Kluin wrote:
> The index is signed, make sure it is not negative
> when we read the array element.
>
> Signed-off-by: Roel Kluin <roel.kluin.DeleteThis@gmail.com>

This is not UBI, this is mtd. I've amended the subject and pushed this
patch to my l2-mtd-2.6, thanks.

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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.DeleteThis@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Display posts from previous:   
Related Topics:
i8042 lockdep false positive. - I just had a user file the report below, which iirc, was deemed a false positive. Didn't we add something to the code....

checkpatch.pl false positive on exported pointers - WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #563: FILE:..

[PATCH] slab: ensure cache_alloc_refill terminates - From: Pekka Enberg <penberg@cs.helsinki.fi> If slab->inuse is corrupted, cache_alloc_refill can enter an infi...

[PATCH] slab: ensure cache_alloc_refill terminates - From: Pekka Enberg <penberg@cs.helsinki.fi> If slab->inuse is corrupted, cache_alloc_refill can enter an infi...

[PATCH] namespace: ensure clone_flags are always stored in.. - While working on unshare support for the network namespace I noticed we were putting clone flags in an int. Which is..

[PATCH 1/3] ensure unique i_ino in filesystems without per.. - This patch lays the groundwork for the other patches: - adds new superblock fields for the generation, IDR hash and it...
       Soft32 Home -> Linux -> Kernel All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Categories:
 Windows
  Linux
 Mac
 PDA


[ Contact us | Terms of Service/Privacy Policy ]