From patchwork Sun Jan 10 11:17:34 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 42573 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id E962D1007D2 for ; Sun, 10 Jan 2010 22:18:06 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753720Ab0AJLRl (ORCPT ); Sun, 10 Jan 2010 06:17:41 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753418Ab0AJLRk (ORCPT ); Sun, 10 Jan 2010 06:17:40 -0500 Received: from smtp.mujha-vel.cz ([81.30.225.246]:40209 "EHLO smtp.mujha-vel.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752817Ab0AJLRk (ORCPT ); Sun, 10 Jan 2010 06:17:40 -0500 Received: from [217.66.174.142] (helo=localhost.localdomain) by smtp.mujha-vel.cz with esmtp (Exim 4.63) (envelope-from ) id 1NTvnf-0001aG-Aw; Sun, 10 Jan 2010 12:17:39 +0100 From: Jiri Slaby To: samuel@sortiz.org Cc: linux-kernel@vger.kernel.org, jirislaby@gmail.com, "David S. Miller" , Alan Cox , Greg Kroah-Hartman , netdev@vger.kernel.org Subject: [PATCH 1/1] NET: irda, remove unnecessary checks Date: Sun, 10 Jan 2010 12:17:34 +0100 Message-Id: <1263122254-18781-1-git-send-email-jslaby@suse.cz> X-Mailer: git-send-email 1.6.5.7 In-Reply-To: <1263114674-10433-1-git-send-email-jslaby@suse.cz> References: <1263114674-10433-1-git-send-email-jslaby@suse.cz> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Stanse found a potential null dereference in ircomm_tty_close and ircomm_tty_hangup. There is a check for tty being NULL, but it is dereferenced earlier. But it is bogus, the tty cannot be NULL, so remove the !tty checks. Signed-off-by: Jiri Slaby Cc: Samuel Ortiz Cc: "David S. Miller" Cc: Alan Cox Cc: Greg Kroah-Hartman Cc: netdev@vger.kernel.org --- net/irda/ircomm/ircomm_tty.c | 6 ------ 1 files changed, 0 insertions(+), 6 deletions(-) diff --git a/net/irda/ircomm/ircomm_tty.c b/net/irda/ircomm/ircomm_tty.c index 811984d..8b85d77 100644 --- a/net/irda/ircomm/ircomm_tty.c +++ b/net/irda/ircomm/ircomm_tty.c @@ -496,9 +496,6 @@ static void ircomm_tty_close(struct tty_struct *tty, struct file *filp) IRDA_DEBUG(0, "%s()\n", __func__ ); - if (!tty) - return; - IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); @@ -1007,9 +1004,6 @@ static void ircomm_tty_hangup(struct tty_struct *tty) IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); - if (!tty) - return; - /* ircomm_tty_flush_buffer(tty); */ ircomm_tty_shutdown(self);