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: <2025090630-desecrate-ensnare-ce9b@gregkh>
Date: Sat, 6 Sep 2025 19:55:55 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Zijun Hu <zijun_hu@...oud.com>
Cc: Danilo Krummrich <dakr@...nel.org>,
	Dave Ertman <david.m.ertman@...el.com>,
	Ira Weiny <ira.weiny@...el.com>, Leon Romanovsky <leon@...nel.org>,
	"Rafael J. Wysocki" <rafael@...nel.org>,
	linux-kernel@...r.kernel.org, Zijun Hu <zijun.hu@....qualcomm.com>
Subject: Re: [PATCH v2] driver core: auxiliary bus: Optimize logic of
 auxiliary_match_id()

On Thu, Sep 04, 2025 at 07:00:37AM +0800, Zijun Hu wrote:
> On 2025/9/3 19:46, Danilo Krummrich wrote:
> >>  static const struct auxiliary_device_id *auxiliary_match_id(const struct auxiliary_device_id *id,
> >>  							    const struct auxiliary_device *auxdev)
> >>  {
> >> -	for (; id->name[0]; id++) {
> >> -		const char *p = strrchr(dev_name(&auxdev->dev), '.');
> >> -		int match_size;
> >> +	const char *auxdev_name = dev_name(&auxdev->dev);
> > I feel like this is a bit too ambitious. Using dev_name() directly for the calls
> > below seems more obvious to me.
> > 
> 
> dev_name(&auxdev->dev) which is a inline function appears 3 times in the
> for loop. may be worthy of a new variable
> 
> 
> > Yes, dev_name() contains a branch, but I'm pretty sure the compiler optimizes
> > them away for subsequent calls anyways.
> 
> >From debugging perspective:
> more difficult to debug if more the compiler optimizes.

You aren't debugging stuff like this :)

Anyway, I've taken this, as it is a nice tiny cleanup, thanks.

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ