From mboxrd@z Thu Jan 1 00:00:00 1970 From: ebiederm@xmission.com (Eric W. Biederman) Subject: Re: [PATCH] netlink: Fix kfree NULL pointer Date: Tue, 07 Sep 2010 22:54:52 -0700 Message-ID: References: <1283923185.2634.772.camel@edumazet-laptop> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Eric Dumazet , "David S. Miller" , Johannes Berg , Alexey Dobriyan , linux-kernel@vger.kernel.org, netdev@vger.kernel.org To: jovi zhang Return-path: In-Reply-To: (jovi zhang's message of "Wed, 8 Sep 2010 13:33:28 +0800") Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org jovi zhang writes: > On Wed, Sep 8, 2010 at 1:19 PM, Eric Dumazet = 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. > =C2=A0Also I check kfree usage in other code, I havn't find any kfree= (NULL) > usage. Usually kfree(NULL) is not explicit, but "var =3D NULL; kfree(var)" is common in error handling paths to reduce the complexity of error handling, making bugs less likely. Eric