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: <9ed5fd73-b4e8-4be1-9642-9dbeb8bfd892@lunn.ch>
Date: Tue, 8 Oct 2024 19:02:18 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Christian Marangi <ansuelsmth@...il.com>
Cc: Heiner Kallweit <hkallweit1@...il.com>,
	Russell King <linux@...linux.org.uk>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [net-next PATCH v2] net: phy: Validate PHY LED OPs presence
 before registering

On Tue, Oct 08, 2024 at 03:13:34PM +0200, Christian Marangi wrote:
> On Tue, Oct 08, 2024 at 03:08:32PM +0200, Andrew Lunn wrote:
> > > +	/* Check if the PHY driver have at least an OP to
> > > +	 * set the LEDs.
> > > +	 */
> > > +	if (!phydev->drv->led_brightness_set &&
> > > +	    !phydev->drv->led_blink_set &&
> > > +	    !phydev->drv->led_hw_control_set) {
> > 
> > I think this condition is too strong. All that should be required is
> > led_brightness_set(). The rest can be done in software.
> >
> 
> Mhh the idea was really to check if one of the 3 is declared. Ideally to
> future proof case where some led will only expose led_hw_control_set or
> only led_blink_set?

Ah, i read it wrong. Sorry.

Maybe apply De Morgan's laws to make it more readable?

+	if (!(phydev->drv->led_brightness_set ||
+	      phydev->drv->led_blink_set ||
+	      phydev->drv->led_hw_control_set)) {

However, it is correct as is.

    Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ