From ca1cce49c2778439d00bbf516f70386f3d3b71e5 Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Sun, 10 Jan 2010 12:30:16 +0100 Subject: [PATCH] Char: synclink, remove unnecessary checks 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 Cc: Andrew Morton Cc: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/char/synclink.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c index 4846b73ef28..0658fc54822 100644 --- a/drivers/char/synclink.c +++ b/drivers/char/synclink.c @@ -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 || -- 2.11.4.GIT