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] [thread-next>] [day] [month] [year] [list]
Message-ID: <2024081314-parched-salary-ec68@gregkh>
Date: Tue, 13 Aug 2024 12:19:42 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: quic_zijuhu <quic_zijuhu@...cinc.com>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>,
	Davidlohr Bueso <dave@...olabs.net>,
	Jonathan Cameron <jonathan.cameron@...wei.com>,
	Dave Jiang <dave.jiang@...el.com>,
	Alison Schofield <alison.schofield@...el.com>,
	Vishal Verma <vishal.l.verma@...el.com>,
	Ira Weiny <ira.weiny@...el.com>,
	Dan Williams <dan.j.williams@...el.com>,
	Takashi Sakamoto <o-takashi@...amocchi.jp>,
	Timur Tabi <timur@...nel.org>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	linux-kernel@...r.kernel.org, linux-cxl@...r.kernel.org,
	linux1394-devel@...ts.sourceforge.net, netdev@...r.kernel.org,
	Zijun Hu <zijun_hu@...oud.com>
Subject: Re: [PATCH 1/5] driver core: Add simple parameter checks for APIs
 device_(for_each|find)_child()

On Tue, Aug 13, 2024 at 06:00:30PM +0800, quic_zijuhu wrote:
> On 8/13/2024 5:44 PM, Greg Kroah-Hartman wrote:
> > On Sun, Aug 11, 2024 at 08:18:07AM +0800, Zijun Hu wrote:
> >> From: Zijun Hu <quic_zijuhu@...cinc.com>
> >>
> >> Add simple parameter checks for APIs device_(for_each|find)_child() and
> >> device_for_each_child_reverse().
> > 
> > Ok, but why?  Who is calling this with NULL as a parent pointer?
> > 
> > Remember, changelog text describes _why_ not just _what_ you are doing.
> > 
> 
> For question why ?
> 
> The main purpose of this change is to make these APIs have *CONSISTENT*
> parameter checking (!parent || !parent->p)
> 
> currently, 2 of them have checking (!parent->p), the other have checking
> (!parent), the are INCONSISTENT.
> 
> 
> For question who ?
> device_find_child() have had such checking (!parent), that maybe mean
> original author has concern that parent may be NULL.
> 
> Moreover, these are core driver APIs, it is worthy checking input
> parameter strictly.

Not always, no, don't check for things that will not happen, otherwise
you are checking for no reason at all.

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ