Skip to contentSkip to conversation

slram: fix read buffer overflow

PATCH In review [email protected] 3 participants 3 messages Aug 6, 2009 – Aug 10, 2009 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 6/8 slram: fix read buffer overflow

From: Roel Kluin <[email protected]>

map[count] is checked before count < SLRAM_MAX_DEVICES_PARAMS

declared on drivers/mtd/devices/slram.c:66:

static char *map[SLRAM_MAX_DEVICES_PARAMS];

---

 drivers/mtd/devices/slram.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/mtd/devices/slram.c renamed from drivers/mtd/devices/slram.c~slram-read-buffer-overflow +2 -3
diff -puN drivers/mtd/devices/slram.c~slram-read-buffer-overflow drivers/mtd/devices/slram.c
@@ -341,9 +341,8 @@ static int __init init_slram(void)
 #else
 	int count;
 
-	for (count = 0; (map[count]) && (count < SLRAM_MAX_DEVICES_PARAMS);
-			count++) {
-	}
+	for (count = 0; count < SLRAM_MAX_DEVICES_PARAMS && map[count]; count++)
+		;
 
 	if ((count % 3 != 0) || (count == 0)) {
 		E("slram: not enough parameters.\n");

_

#1 lore raw
Quoted 5 lines · On Thu, Aug 06, 2009 at 04:05:36PM -0700, [email protected] wrote:

From: Roel Kluin <[email protected]>

map[count] is checked before count < SLRAM_MAX_DEVICES_PARAMS

declared on drivers/mtd/devices/slram.c:66:

Didn't we obsolete this driver with phram? I don't mean to derail the patch, but I'm wondering why slram still exists at all.

josh

#2 lore raw
Quoted 9 lines · Josh Boyer
Quoted 5 lines · On Thu, Aug 06, 2009 at 04:05:36PM -0700, [email protected] wrote:

From: Roel Kluin<[email protected]>

map[count] is checked before count< SLRAM_MAX_DEVICES_PARAMS

declared on drivers/mtd/devices/slram.c:66:

Didn't we obsolete this driver with phram? I don't mean to derail the patch, but I'm wondering why slram still exists at all.

Feel free to send a patch. Meanwhile, I've put this fix to my l2-mtd-2.6.git.

Signature · 2 lines
Best Regards,
Artem Bityutskiy (Артём Битюцкий)