Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933526AbbHJXbF (ORCPT ); Mon, 10 Aug 2015 19:31:05 -0400 Received: from mga11.intel.com ([192.55.52.93]:46561 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932584AbbHJXbD convert rfc822-to-8bit (ORCPT ); Mon, 10 Aug 2015 19:31:03 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,649,1432623600"; d="scan'208";a="780828281" From: "Dilger, Andreas" To: Shraddha Barke , "Drokin, Oleg" , Greg Kroah-Hartman , Benjamin Romer , Johnny Kim , Rachel Kim , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 1/3] Staging: wilc1000: Remove null check before kfree Thread-Topic: [PATCH 1/3] Staging: wilc1000: Remove null check before kfree Thread-Index: AQHQ00K9N8xqj5UJTkWOs3VqVVuIA54F8+gA Date: Mon, 10 Aug 2015 23:30:58 +0000 Message-ID: References: <1439193635-6063-1-git-send-email-shraddha.6596@gmail.com> In-Reply-To: <1439193635-6063-1-git-send-email-shraddha.6596@gmail.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.254.115.92] Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1445 Lines: 62 On 2015/08/10, 2:00 AM, "Shraddha Barke" wrote: >kfree on NULL pointer is a no-op. Hi, please don't CC the hpdd-discuss list, nor Oleg or I for patches unrelated to Lustre. Cheers, Andreas >This patch uses the following semantic patch to find such an instance >where NULL check is present before kfree. > >// >@@ expression E; @@ >- if (E != NULL) { kfree(E); } >+ kfree(E); >@@ expression E; @@ >- if (E != NULL) { kfree(E); E = NULL; } >+ kfree(E); >+ E = NULL; >// smpl> > >Signed-off-by: Shraddha Barke >--- > drivers/staging/wilc1000/linux_wlan.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > >diff --git a/drivers/staging/wilc1000/linux_wlan.c >b/drivers/staging/wilc1000/linux_wlan.c >index 3e55a8a..3dcd6e5 100644 >--- a/drivers/staging/wilc1000/linux_wlan.c >+++ b/drivers/staging/wilc1000/linux_wlan.c >@@ -2343,8 +2343,7 @@ int mac_ioctl(struct net_device *ndev, struct ifreq >*req, int cmd) > > done: > >- if (buff != NULL) >- kfree(buff); >+ kfree(buff); > > return s32Error; > } >-- >2.1.0 > > Cheers, Andreas -- Andreas Dilger Lustre Software Architect Intel High Performance Data Division -- 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/