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: <20250915110000.GS224143@horms.kernel.org>
Date: Mon, 15 Sep 2025 12:00:00 +0100
From: Simon Horman <horms@...nel.org>
To: Christian Marangi <ansuelsmth@...il.com>
Cc: Lee Jones <lee@...nel.org>, Rob Herring <robh@...nel.org>,
	Krzysztof Kozlowski <krzk+dt@...nel.org>,
	Conor Dooley <conor+dt@...nel.org>,
	Andrew Lunn <andrew+netdev@...n.ch>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	Vladimir Oltean <olteanv@...il.com>,
	Heiner Kallweit <hkallweit1@...il.com>,
	Russell King <linux@...linux.org.uk>,
	"Chester A. Unal" <chester.a.unal@...nc9.com>,
	Daniel Golle <daniel@...rotopia.org>,
	DENG Qingfang <dqfext@...il.com>,
	Sean Wang <sean.wang@...iatek.com>,
	Matthias Brugger <matthias.bgg@...il.com>,
	AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
	linux-arm-kernel@...ts.infradead.org,
	linux-mediatek@...ts.infradead.org, netdev@...r.kernel.org,
	devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [net-next PATCH v17 6/8] mfd: an8855: Add support for Airoha
 AN8855 Switch MFD

On Sat, Sep 13, 2025 at 03:04:40PM +0200, Christian Marangi wrote:
> On Sat, Sep 13, 2025 at 02:01:37PM +0100, Simon Horman wrote:
> > On Thu, Sep 11, 2025 at 03:39:21PM +0200, Christian Marangi wrote:
> > > Add support for Airoha AN8855 Switch MFD that provide support for a DSA
> > > switch and a NVMEM provider.
> > > 
> > > Also make use of the mdio-regmap driver and register a regmap for each
> > > internal PHY of the switch.
> > > This is needed to handle the double usage of the PHYs as both PHY and
> > > Switch accessor.
> > > 
> > > Signed-off-by: Christian Marangi <ansuelsmth@...il.com>
> > 
> > ...
> > 
> > > diff --git a/drivers/mfd/airoha-an8855.c b/drivers/mfd/airoha-an8855.c
> > 
> > ...
> > 
> > > +static int an855_mdio_register(struct device *dev, struct an8855_core_priv *priv)
> > > +{
> > > +	struct device_node *mdio_np;
> > > +	int ret;
> > > +
> > > +	mdio_np = of_get_child_by_name(dev->of_node, "mdio");
> > > +	if (!mdio_np)
> > > +		return -ENODEV;
> > > +
> > > +	for_each_available_child_of_node_scoped(mdio_np, phy_np) {
> > > +		ret = an8855_phy_register(dev, priv, phy_np);
> > > +		if (ret)
> > > +			break;
> > > +	}
> > 
> > Hi Christian,
> > 
> > Maybe it cannot happen, but if the loop above iterates zero times,
> > then ret will be used uninitialised below.
> > 
> > Flagged by Smatch.
> >
> 
> Do you have hint of how to run smatch on this? Is there a simple arg to
> make to enable this?

Perhaps not so simple, but also not so difficult.

1. Checkout Smatch from and compile

   Smatch can be found in Git here:
   https://github.com/error27/smatch/commits/master/

2. Prepare kernel

   e.g. make allmodconfig

3. Run Smatch

   PATH="$PATH:.../smatch/bin" \
   .../smatch/smatch_scripts/kchecker drivers/mfd/airoha-an8855.o
   [ snip ]
   drivers/mfd/airoha-an8855.c:439 an855_mdio_register() error: uninitialized symbol 'ret'.

> Anyway yes it goes against schema but it's possible somehow to have a
> very broken DT node with no phy in it.

Understood, thanks.

...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ