Message ID | 200908062305.n76N5aeS004967@imap1.linux-foundation.org |
---|---|
State | New, archived |
Headers | show |
On Thu, Aug 06, 2009 at 04:05:36PM -0700, akpm@linux-foundation.org wrote: >From: Roel Kluin <roel.kluin@gmail.com> > >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
On 08/07/2009 05:58 AM, Josh Boyer wrote: > On Thu, Aug 06, 2009 at 04:05:36PM -0700, akpm@linux-foundation.org wrote: >> From: Roel Kluin<roel.kluin@gmail.com> >> >> 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.
diff -puN drivers/mtd/devices/slram.c~slram-read-buffer-overflow drivers/mtd/devices/slram.c --- a/drivers/mtd/devices/slram.c~slram-read-buffer-overflow +++ a/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");