Skip to contentSkip to conversation

powerpc: Read buffer overflow

PATCH New Roel Kluin 1 participant 1 message Aug 3, 2009 Char and misc drivers

lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 powerpc: Read buffer overflow

Check whether index is within bounds before grabbing the element.

---

drivers/char/hvsi.c +2 -1
index 2989056..793b236 100644
@@ -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);