From patchwork Wed Jul 29 00:50:21 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Woithe X-Patchwork-Id: 38038 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n6T0p0Ft013260 for ; Wed, 29 Jul 2009 00:51:00 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751023AbZG2Auz (ORCPT ); Tue, 28 Jul 2009 20:50:55 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752349AbZG2Auz (ORCPT ); Tue, 28 Jul 2009 20:50:55 -0400 Received: from adelphi.physics.adelaide.edu.au ([129.127.102.1]:39802 "EHLO adelphi.physics.adelaide.edu.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751023AbZG2Auz (ORCPT ); Tue, 28 Jul 2009 20:50:55 -0400 Received: from mercury.physics.adelaide.edu.au (IDENT:0@mercury [129.127.102.44]) by adelphi.physics.adelaide.edu.au (8.13.7/8.13.7/UofA-Physics-1.0) with ESMTP id n6T0oLuI008760; Wed, 29 Jul 2009 10:20:21 +0930 Received: from mercury.physics.adelaide.edu.au (IDENT:7157@localhost [127.0.0.1]) by mercury.physics.adelaide.edu.au (8.13.4/8.13.4) with ESMTP id n6T0oLsq024741; Wed, 29 Jul 2009 10:20:21 +0930 Received: (from jwoithe@localhost) by mercury.physics.adelaide.edu.au (8.13.4/8.13.4/Submit) id n6T0oL0o024740; Wed, 29 Jul 2009 10:20:21 +0930 From: Jonathan Woithe Message-Id: <200907290050.n6T0oL0o024740@mercury.physics.adelaide.edu.au> Subject: Re: [PATCH 6/12] drivers/platform/x86: Correct redundant test To: pmarques@grupopie.com (Paulo Marques) Date: Wed, 29 Jul 2009 10:20:21 +0930 (CST) Cc: julia@diku.dk (Julia Lawall), jwoithe@physics.adelaide.edu.au, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org In-Reply-To: <4A6F3AEA.7090102@grupopie.com> from "Paulo Marques" at Jul 28, 2009 06:52:42 PM X-Mailer: ELM [version 2.5 PL6] MIME-Version: 1.0 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Hi guys > Julia Lawall wrote: > > [...] > > --- > > drivers/platform/x86/fujitsu-laptop.c | 3 --- > > 1 files changed, 0 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c > > index 218b9a1..5306901 100644 > > --- a/drivers/platform/x86/fujitsu-laptop.c > > +++ b/drivers/platform/x86/fujitsu-laptop.c > > @@ -745,9 +745,6 @@ static int acpi_fujitsu_remove(struct acpi_device *device, int type) > > > > fujitsu = acpi_driver_data(device); > > > > - if (!device || !acpi_driver_data(device)) > > - return -EINVAL; > > - > > Shouldn't this still do a: > > if (!fujitsu) > return -EINVAL; > > to avoid dereferencing a NULL pointer below? Hmm, yes it should. Well spotted. And I'm not certain how the duplicate test on "device" got in there in the first place. I suspect it came about due to some structural changes made a few versions ago and I failed to notice that the second check became redundant. So, combining this with the above patch we should instead do Signed-off-by: jwoithe@physics.adelaide.edu.au Regards jonathan --- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/drivers/platform/x86/fujitsu-laptop.c 2009-06-12 19:51:45.333234000 +0930 +++ b/drivers/platform/x86/fujitsu-laptop.c 2009-07-29 10:14:30.610249941 +0930 @@ -745,7 +745,7 @@ static int acpi_fujitsu_remove(struct ac fujitsu = acpi_driver_data(device); - if (!device || !acpi_driver_data(device)) + if (!fujitsu) return -EINVAL; fujitsu->acpi_handle = NULL;