public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] powerpc: Read buffer overflow
@ 2009-08-03 11:48 Roel Kluin
  0 siblings, 0 replies; only message in thread
From: Roel Kluin @ 2009-08-03 11:48 UTC (permalink / raw)
  To: LKML; +Cc: Bernd Petrovitsch, Andrew Morton

Check whether index is within bounds before grabbing the element.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/drivers/char/hvsi.c b/drivers/char/hvsi.c
index 2989056..793b236 100644
--- a/drivers/char/hvsi.c
+++ b/drivers/char/hvsi.c
@@ -1230,11 +1230,12 @@ static struct tty_driver *hvsi_console_device(struct console *console,
 
 static int __init hvsi_console_setup(struct console *console, char *options)
 {
-	struct hvsi_struct *hp = &hvsi_ports[console->index];
+	struct hvsi_struct *hp;
 	int ret;
 
 	if (console->index < 0 || console->index >= hvsi_count)
 		return -1;
+	hp = &hvsi_ports[console->index];
 
 	/* give the FSP a chance to change the baud rate when we re-open */
 	hvsi_close_protocol(hp);

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2009-08-03 11:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-03 11:48 [PATCH] powerpc: Read buffer overflow Roel Kluin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox