public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: jovi zhang <bookjovi@gmail.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Johannes Berg <johannes.berg@intel.com>,
	Alexey Dobriyan <adobriyan@openvz.org>,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH] netlink: Fix kfree NULL pointer
Date: Tue, 07 Sep 2010 22:54:52 -0700	[thread overview]
Message-ID: <m1tym0vkyb.fsf@fess.ebiederm.org> (raw)
In-Reply-To: <AANLkTim+=vj+k3=1hzT3=J4ssOopp5Eq=g+DHis=pZFN@mail.gmail.com> (jovi zhang's message of "Wed, 8 Sep 2010 13:33:28 +0800")

jovi zhang <bookjovi@gmail.com> writes:

> On Wed, Sep 8, 2010 at 1:19 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
>>
>>
>> This patch is not needed
>>
>> kfree(NULL) is legal
>>
>>
>>
>>
>
> YES, maybe kfree(NULL) is legal, but I cannot see there have any need
> to invoke kfree(NULL) in this function.
>  Also I check kfree usage in other code, I havn't find any kfree(NULL)
> usage.

Usually kfree(NULL) is not explicit, but "var = NULL; kfree(var)" is
common in error handling paths to reduce the complexity of error
handling, making bugs less likely.


Eric

  parent reply	other threads:[~2010-09-08  5:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <AANLkTikp0m8cQYfEBHP_E8XpGZqdMj6Cr4M=aWCnei=X@mail.gmail.com>
2010-09-08  5:19 ` [PATCH] netlink: Fix kfree NULL pointer Eric Dumazet
2010-09-08  5:33   ` jovi zhang
2010-09-08  5:53     ` David Miller
2010-09-08  5:54     ` Eric W. Biederman [this message]
2010-09-08  5:55     ` Eric Dumazet
2010-09-08  6:14       ` jovi zhang
2010-09-08  5:13 jovi zhang

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=m1tym0vkyb.fsf@fess.ebiederm.org \
    --to=ebiederm@xmission.com \
    --cc=adobriyan@openvz.org \
    --cc=bookjovi@gmail.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=johannes.berg@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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