Skip to content

Commit

Permalink
powerpc/hvsi: Avoid calculating possibly-invalid address
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Roel Kluin authored and Benjamin Herrenschmidt committed Aug 20, 2009
1 parent 6826a57 commit 7286565
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/char/hvsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7286565

Please sign in to comment.