lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240111130513.GK1678981@google.com>
Date: Thu, 11 Jan 2024 13:05:13 +0000
From: Lee Jones <lee@...nel.org>
To: Markus Elfring <Markus.Elfring@....de>
Cc: linux-leds@...r.kernel.org, kernel-janitors@...r.kernel.org,
	Pavel Machek <pavel@....cz>, LKML <linux-kernel@...r.kernel.org>,
	cocci@...ia.fr
Subject: Re: leds: trigger: oneshot: One function call less in pattern_init()
 after error detection

On Thu, 11 Jan 2024, Markus Elfring wrote:

> >> The kfree() function was called in one case by
> >> the pattern_init() function during error handling
> >> even if the passed variable contained a null pointer.
> >
> > It's totally valid to call kfree() on a NULL pointer:
> >
> >   * If @object is NULL, no operation is performed.
> >
> > Why do we care all that much?
> 
> Would you dare to categorise such special function calls as redundant?
> 
> Should they be skipped in more cases?
> 
> See also:
> https://wiki.sei.cmu.edu/confluence/display/c/MEM12-C.+Consider+using+a+goto+chain+when+leaving+a+function+on+error+when+using+and+releasing+resources

I have no idea what you're trying to say.

The premise of your patch is based on the fact that we shouldn't call
kfree() with a NULL pointer.  When in actual fact kfree() is more than
capable of handling cases where the passed object is NULL, and goes as
far as to document as such.  Meaning that unless I'm convinced
otherwise, patches like this remain in the category of churn.

-- 
Lee Jones [李琼斯]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ