Char: synclink, remove unnecessary checks
authorJiri Slaby <jslaby@suse.cz>
Sun, 10 Jan 2010 11:30:16 +0000 (12:30 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 2 Mar 2010 22:43:16 +0000 (14:43 -0800)
Stanse found a potential null dereference in mgsl_put_char and
mgsl_write. There is a check for tty being NULL, but it is
dereferenced earlier.

Actually, tty cannot be NULL in .write and .put_char, so remove
the tests.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/char/synclink.c

index 4846b73ef28dc0e5db78ff11a4e3fd2b972b5a84..0658fc5482225089d07abda0d4c43f582d1e0890 100644 (file)
@@ -2031,7 +2031,7 @@ static int mgsl_put_char(struct tty_struct *tty, unsigned char ch)
        if (mgsl_paranoia_check(info, tty->name, "mgsl_put_char"))
                return 0;
 
-       if (!tty || !info->xmit_buf)
+       if (!info->xmit_buf)
                return 0;
 
        spin_lock_irqsave(&info->irq_spinlock, flags);
@@ -2121,7 +2121,7 @@ static int mgsl_write(struct tty_struct * tty,
        if (mgsl_paranoia_check(info, tty->name, "mgsl_write"))
                goto cleanup;
 
-       if (!tty || !info->xmit_buf)
+       if (!info->xmit_buf)
                goto cleanup;
 
        if ( info->params.mode == MGSL_MODE_HDLC ||