All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch 6/8] slram: fix read buffer overflow
@ 2009-08-06 23:05 akpm
  2009-08-07  2:58 ` Josh Boyer
  0 siblings, 1 reply; 3+ messages in thread
From: akpm @ 2009-08-06 23:05 UTC (permalink / raw)
  To: dwmw2; +Cc: roel.kluin, akpm, linux-mtd

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:

static char *map[SLRAM_MAX_DEVICES_PARAMS];

[akpm@linux-foundation.org: cleanups]
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 drivers/mtd/devices/slram.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

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");
_

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-08-10  7:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-06 23:05 [patch 6/8] slram: fix read buffer overflow akpm
2009-08-07  2:58 ` Josh Boyer
2009-08-10  7:04   ` Artem Bityutskiy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.