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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 5 Apr 2023 23:31:07 +0300
From:   Vladimir Oltean <vladimir.oltean@....com>
To:     Simon Horman <simon.horman@...igine.com>
Cc:     netdev@...r.kernel.org, Jakub Kicinski <kuba@...nel.org>,
        "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Paolo Abeni <pabeni@...hat.com>, Andrew Lunn <andrew@...n.ch>,
        Florian Fainelli <f.fainelli@...il.com>
Subject: Re: [RFC PATCH net-next] net: dsa: replace
 NETDEV_PRE_CHANGE_HWTSTAMP notifier with a stub

On Wed, Apr 05, 2023 at 10:05:15PM +0200, Simon Horman wrote:
> > +static inline int dsa_master_hwtstamp_validate(struct net_device *dev,
> > +					       const struct kernel_hwtstamp_config *config,
> > +					       struct netlink_ext_ack *extack)
> > +{
> > +	int err;
> > +
> > +	if (!netdev_uses_dsa(dev))
> > +		return 0;
> > +
> > +	mutex_lock(&dsa_stubs_lock);
> > +
> > +	if (dsa_stubs)
> > +		err = dsa_stubs->master_hwtstamp_validate(dev, config, extack);
> > +
> > +	mutex_unlock(&dsa_stubs_lock);
> 
> nit: clang-16 tells me that err is uninitialised here if dsa_stubs is false.

In fact, clang-16 is saying something much smarter than that, because I
did test this code path and it did work reliably (not like an uninitialized
return value would).

It's saying that when netdev_uses_dsa() returns true, the DSA module has
surely been loaded, so the stubs have surely been registered, so the
mutex_lock() and the check for the NULL quality of dsa_stubs are
completely redundant and can be removed.

> > +
> > +	return err;
> > +}
> > +
> > +#else

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ