Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932797AbbBBQgt (ORCPT ); Mon, 2 Feb 2015 11:36:49 -0500 Received: from mail-pa0-f54.google.com ([209.85.220.54]:44629 "EHLO mail-pa0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932249AbbBBQgq (ORCPT ); Mon, 2 Feb 2015 11:36:46 -0500 Date: Mon, 2 Feb 2015 22:06:33 +0530 From: Sudip Mukherjee To: Rickard Strandqvist Cc: Greg Kroah-Hartman , Kiran Padwal , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] staging: gdm724x: gdm_tty: Fix for possible null pointer dereference Message-ID: <20150202163633.GA30631@sudip-PC> References: <1422557170-3357-1-git-send-email-rickard_strandqvist@spectrumdigital.se> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1422557170-3357-1-git-send-email-rickard_strandqvist@spectrumdigital.se> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1657 Lines: 41 On Thu, Jan 29, 2015 at 07:46:10PM +0100, Rickard Strandqvist wrote: > Fix a possible null pointer dereference, there is > otherwise a risk of a possible null pointer dereference. > > This was found using a static code analysis program called cppcheck > > Signed-off-by: Rickard Strandqvist > --- > drivers/staging/gdm724x/gdm_tty.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/gdm724x/gdm_tty.c b/drivers/staging/gdm724x/gdm_tty.c > index 001348c..66b356e 100644 > --- a/drivers/staging/gdm724x/gdm_tty.c > +++ b/drivers/staging/gdm724x/gdm_tty.c > @@ -145,7 +145,7 @@ static int gdm_tty_recv_complete(void *data, > struct gdm *gdm = tty_dev->gdm[index]; > > if (!GDM_TTY_READY(gdm)) { > - if (complete == RECV_PACKET_PROCESS_COMPLETE) > + if (gdm && complete == RECV_PACKET_PROCESS_COMPLETE) GDM_TTY_READY() is already checking for gdm, there is no chance that gdm can be null at this point. so this additional check is not required. regards sudip > gdm_tty_recv(gdm, gdm_tty_recv_complete); > return TO_HOST_PORT_CLOSE; > } > -- > 1.7.10.4 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/