Skip to content

Commit

Permalink
Char: synclink, remove unnecessary checks
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jiri Slaby authored and Greg Kroah-Hartman committed Mar 2, 2010
1 parent e6c4ef9 commit ca1cce4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/char/synclink.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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 ||
Expand Down

0 comments on commit ca1cce4

Please sign in to comment.