Patchwork slram: Read buffer overflow

login
register
mail settings
Submitter roel kluin
Date July 31, 2009, 12:47 p.m.
Message ID <4A72E7FE.6000207@gmail.com>
Download mbox | patch
Permalink /patch/30428/
State Accepted
Commit 269c0ee66367b11de9758ee64ea039843f0c7cad
Headers show

Comments

roel kluin - July 31, 2009, 12:47 p.m.
map[count] is checked before count < SLRAM_MAX_DEVICES_PARAMS

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
declared on drivers/mtd/devices/slram.c:66:

static char *map[SLRAM_MAX_DEVICES_PARAMS];

Patch

diff --git a/drivers/mtd/devices/slram.c b/drivers/mtd/devices/slram.c
index 00248e8..239500b 100644
--- a/drivers/mtd/devices/slram.c
+++ b/drivers/mtd/devices/slram.c
@@ -341,7 +341,7 @@  static int init_slram(void)
 #else
 	int count;
 
-	for (count = 0; (map[count]) && (count < SLRAM_MAX_DEVICES_PARAMS);
+	for (count = 0; count < SLRAM_MAX_DEVICES_PARAMS && map[count];
 			count++) {
 	}