From: "Dilger, Andreas" <andreas.dilger@intel.com>
To: Shraddha Barke <shraddha.6596@gmail.com>,
"Drokin, Oleg" <oleg.drokin@intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Benjamin Romer <benjamin.romer@unisys.com>,
Johnny Kim <johnny.kim@atmel.com>,
Rachel Kim <rachel.kim@atmel.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/3] Staging: wilc1000: Remove null check before kfree
Date: Mon, 10 Aug 2015 23:30:58 +0000 [thread overview]
Message-ID: <D1EE904E.100897%andreas.dilger@intel.com> (raw)
In-Reply-To: <1439193635-6063-1-git-send-email-shraddha.6596@gmail.com>
On 2015/08/10, 2:00 AM, "Shraddha Barke" <shraddha.6596@gmail.com> 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.
>
>// <smpl>
>@@ expression E; @@
>- if (E != NULL) { kfree(E); }
>+ kfree(E);
>@@ expression E; @@
>- if (E != NULL) { kfree(E); E = NULL; }
>+ kfree(E);
>+ E = NULL;
>// </smpl>smpl>
>
>Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
>---
> 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
prev parent reply other threads:[~2015-08-10 23:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-10 8:00 [PATCH 1/3] Staging: wilc1000: Remove null check before kfree Shraddha Barke
2015-08-10 8:00 ` [PATCH 2/3] Staging: lustre: libcfs: Remove unnecessary cast on void* Shraddha Barke
2015-08-10 8:00 ` [PATCH 3/3] Staging: unisys: Remove useless cast on void pointer Shraddha Barke
2015-08-10 23:30 ` Dilger, Andreas [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=D1EE904E.100897%andreas.dilger@intel.com \
--to=andreas.dilger@intel.com \
--cc=benjamin.romer@unisys.com \
--cc=gregkh@linuxfoundation.org \
--cc=johnny.kim@atmel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg.drokin@intel.com \
--cc=rachel.kim@atmel.com \
--cc=shraddha.6596@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox