Commit 72865650 authored by Roel Kluin's avatar Roel Kluin Committed by Benjamin Herrenschmidt

powerpc/hvsi: Avoid calculating possibly-invalid address

Check whether index is within bounds prior to calculating a
possibly-invalid address.
Signed-off-by: default avatarRoel Kluin <roel.kluin@gmail.com>
Cc: Bernd Petrovitsch <bernd@firmix.at>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent 6826a57d
...@@ -1230,11 +1230,12 @@ static struct tty_driver *hvsi_console_device(struct console *console, ...@@ -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) 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; int ret;
if (console->index < 0 || console->index >= hvsi_count) if (console->index < 0 || console->index >= hvsi_count)
return -1; return -1;
hp = &hvsi_ports[console->index];
/* give the FSP a chance to change the baud rate when we re-open */ /* give the FSP a chance to change the baud rate when we re-open */
hvsi_close_protocol(hp); hvsi_close_protocol(hp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment