aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoel Kluin <roel.kluin@gmail.com>2009-08-06 13:00:37 +0000
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-08-20 10:29:28 +1000
commit728656506447b3b349d082a7fb99445f9cb0caaa (patch)
tree191c955b70e92e8fca448c71884b41e52ac97b07
parent6826a57d1abc8ac9f59b24f1a008554c6560a995 (diff)
powerpc/hvsi: Avoid calculating possibly-invalid address
Check whether index is within bounds prior to calculating a possibly-invalid address. Signed-off-by: Roel Kluin <roel.kluin@gmail.com> Cc: Bernd Petrovitsch <bernd@firmix.at> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r--drivers/char/hvsi.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/char/hvsi.c b/drivers/char/hvsi.c
index 2989056a9e3..793b236c926 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);