netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Chris Packham <chris.packham@alliedtelesis.co.nz>
Cc: lee@kernel.org, robh@kernel.org, krzk+dt@kernel.org,
	conor+dt@kernel.org, andrew+netdev@lunn.ch, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	tsbogend@alpha.franken.de, hkallweit1@gmail.com,
	linux@armlinux.org.uk, markus.stockhausen@gmx.de,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org, linux-mips@vger.kernel.org,
	Dan Carpenter <dan.carpenter@linaro.org>
Subject: Re: [PATCH v2 4/4] net: mdio: Add RTL9300 MDIO driver
Date: Tue, 17 Dec 2024 10:35:09 +0000	[thread overview]
Message-ID: <20241217103509.GO780307@kernel.org> (raw)
In-Reply-To: <cf77f08d-0516-4adf-a701-9589f0d99eb5@alliedtelesis.co.nz>

+ Dan Carpenter

On Tue, Dec 17, 2024 at 10:47:10AM +1300, Chris Packham wrote:
> 
> On 17/12/2024 05:48, Simon Horman wrote:
> > On Mon, Dec 16, 2024 at 04:13:46PM +1300, Chris Packham wrote:
> > > Add a driver for the MDIO controller on the RTL9300 family of Ethernet
> > > switches with integrated SoC. There are 4 physical SMI interfaces on the
> > > RTL9300 but access is done using the switch ports so a single MDIO bus
> > > is presented to the rest of the system.
> > > 
> > > Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>

...

> > > +		if (smi_addr[0] > MAX_SMI_BUSSES)
> > Hi Chris,
> > 
> > Should this condition be
> > 
> > 		if (smi_addr[0] >= MAX_SMI_BUSSES)
> Yes. You are correct.
> > > +			return dev_err_probe(dev, -EINVAL, "illegal smi bus number %d\n",
> > > +					     smi_addr[0]);
> > > +
> > > +		if (smi_addr[1] > MAX_SMI_ADDR)
> > > +			return dev_err_probe(dev, -EINVAL, "illegal smi addr %d\n", smi_addr[1]);
> > > +
> > > +		if (fwnode_device_is_compatible(child, "ethernet-phy-ieee802.3-c45"))
> > > +			priv->smi_bus_isc45[smi_addr[0]] = true;
> > Otherwise it seems that smi_bus_isc45 may overflow here.
> > 
> > Flagged by Smatch.
> 
> Sounds like something I should start looking at for myself. Have you got a
> link to share?

Hi Chris,

Smatch is here: https://github.com/error27/smatch
And my usage of it is informed by
https://blogs.oracle.com/linux/post/smatch-static-analysis-tool-overview-by-dan-carpenter

FWIIW, I run it usking kchecker on individual source files.

I've also CCed the author, Dan Carpenter, for good measure.

...

  reply	other threads:[~2024-12-17 10:35 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-16  3:13 [PATCH v2 0/4] RTL9300 MDIO driver Chris Packham
2024-12-16  3:13 ` [PATCH v2 1/4] dt-bindings: net: Add Realtek MDIO controller Chris Packham
2024-12-16 18:52   ` Conor Dooley
2024-12-16 19:57     ` Chris Packham
2024-12-16  3:13 ` [PATCH v2 2/4] dt-bindings: mfd: Add MDIO interface to rtl9301-switch Chris Packham
2024-12-16 18:53   ` Conor Dooley
2024-12-16 19:36     ` Chris Packham
2024-12-17 15:07   ` (subset) " Lee Jones
2024-12-19 20:49     ` Chris Packham
2024-12-23 10:08       ` Lee Jones
2024-12-16  3:13 ` [PATCH v2 3/4] mips: dts: realtek: Add MDIO controller Chris Packham
2024-12-16  3:13 ` [PATCH v2 4/4] net: mdio: Add RTL9300 MDIO driver Chris Packham
2024-12-16 16:48   ` Simon Horman
2024-12-16 21:47     ` Chris Packham
2024-12-17 10:35       ` Simon Horman [this message]
2024-12-19  4:46   ` Luiz Angelo Daros de Luca
2024-12-19  9:40     ` Andrew Lunn
2024-12-19 20:36       ` Chris Packham
2024-12-20  5:11         ` Luiz Angelo Daros de Luca
2024-12-19 20:50     ` Chris Packham

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241217103509.GO780307@kernel.org \
    --to=horms@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=chris.packham@alliedtelesis.co.nz \
    --cc=conor+dt@kernel.org \
    --cc=dan.carpenter@linaro.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=lee@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=markus.stockhausen@gmx.de \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=robh@kernel.org \
    --cc=tsbogend@alpha.franken.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).