All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Shreeya Patel <shreeya.patel23498@gmail.com>
Cc: samuel@sortiz.org, gregkh@linuxfoundation.org,
	netdev@vger.kernel.org, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Staging: irda: Do not check for NOT NULL before kfree()
Date: Mon, 18 Dec 2017 11:20:38 -0800	[thread overview]
Message-ID: <20171218112038.15626e20@xeon-e3> (raw)
In-Reply-To: <1513624290-2965-1-git-send-email-shreeya.patel23498@gmail.com>

On Tue, 19 Dec 2017 00:41:30 +0530
Shreeya Patel <shreeya.patel23498@gmail.com> wrote:

> Do not check for NOT NULL before calling kfree because if the
> pointer is NULL, no action occurs.
> Done using the following semantic patch by coccinelle.
> 
> @@
> expression ptr;
> @@
> 
> - if (ptr != NULL) {
>   kfree(ptr);
>   ptr = NULL;
> - }
> 
> The semantic patch has the effect of adding an assignment
> of ptr to NULL in the case where ptr is NULL already.
> 
> Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>

Please read drivers/staging/irda/TODO

WARNING: multiple messages have this Message-ID (diff)
From: Stephen Hemminger <stephen@networkplumber.org>
To: Shreeya Patel <shreeya.patel23498@gmail.com>
Cc: devel@driverdev.osuosl.org, gregkh@linuxfoundation.org,
	samuel@sortiz.org, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org
Subject: Re: [PATCH] Staging: irda: Do not check for NOT NULL before kfree()
Date: Mon, 18 Dec 2017 11:20:38 -0800	[thread overview]
Message-ID: <20171218112038.15626e20@xeon-e3> (raw)
In-Reply-To: <1513624290-2965-1-git-send-email-shreeya.patel23498@gmail.com>

On Tue, 19 Dec 2017 00:41:30 +0530
Shreeya Patel <shreeya.patel23498@gmail.com> wrote:

> Do not check for NOT NULL before calling kfree because if the
> pointer is NULL, no action occurs.
> Done using the following semantic patch by coccinelle.
> 
> @@
> expression ptr;
> @@
> 
> - if (ptr != NULL) {
>   kfree(ptr);
>   ptr = NULL;
> - }
> 
> The semantic patch has the effect of adding an assignment
> of ptr to NULL in the case where ptr is NULL already.
> 
> Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>

Please read drivers/staging/irda/TODO

  reply	other threads:[~2017-12-18 19:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-18 19:11 [PATCH] Staging: irda: Do not check for NOT NULL before kfree() Shreeya Patel
2017-12-18 19:20 ` Stephen Hemminger [this message]
2017-12-18 19:20   ` Stephen Hemminger
2017-12-18 19:27   ` Shreeya Patel
2017-12-18 19:27     ` Shreeya Patel

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=20171218112038.15626e20@xeon-e3 \
    --to=stephen@networkplumber.org \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=samuel@sortiz.org \
    --cc=shreeya.patel23498@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.