slram: fix read buffer overflow
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
@@ -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" );
_
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_PARAMSdeclared 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
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_PARAMSdeclared 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 (Артём Битюцкий)