goldfish: off by one in goldfish_tty_console_setup()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 29 Oct 2014 08:43:25 +0000 (11:43 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 6 Nov 2014 00:12:45 +0000 (16:12 -0800)
The goldfish_ttys[] array has "goldfish_tty_line_count" number of
elements.  It's allocated in goldfish_tty_create_driver().  This test
should be >= instead of >.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/goldfish.c

index c24b9633ae195bc7044003863b6bfd3290f9e3fa..967b2c2b7cf1063e6d638dcb2e7b3b3b9bde37f0 100644 (file)
@@ -155,7 +155,7 @@ static struct tty_driver *goldfish_tty_console_device(struct console *c,
 
 static int goldfish_tty_console_setup(struct console *co, char *options)
 {
-       if ((unsigned)co->index > goldfish_tty_line_count)
+       if ((unsigned)co->index >= goldfish_tty_line_count)
                return -ENODEV;
        if (!goldfish_ttys[co->index].base)
                return -ENODEV;