From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: linux-usb@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Subject: Re: [PATCH net v1 1/1] net: usb: asix: ax88772: Increase phy_name size
Date: Wed, 19 Mar 2025 12:49:26 +0200 [thread overview]
Message-ID: <Z9qhNnnwkMaMCbI1@smile.fi.intel.com> (raw)
In-Reply-To: <Z9qd6HfmfE18Clxv@smile.fi.intel.com>
On Wed, Mar 19, 2025 at 12:35:21PM +0200, Andy Shevchenko wrote:
> On Tue, Mar 18, 2025 at 06:09:12PM +0100, Andrew Lunn wrote:
> > On Tue, Mar 18, 2025 at 06:54:48PM +0200, Andy Shevchenko wrote:
> > > On Tue, Mar 18, 2025 at 05:49:05PM +0100, Andrew Lunn wrote:
...
> > > > > - char phy_name[20];
> > > > > + char phy_name[MII_BUS_ID_SIZE + 5];
> > > >
> > > > Could you explain the + 5?
> > > >
> > > > https://elixir.bootlin.com/linux/v6.13.7/source/drivers/net/ethernet/davicom/dm9051.c#L1156
> > > > https://elixir.bootlin.com/linux/v6.13.7/source/drivers/net/ethernet/freescale/fec_main.c#L2454
> > > > https://elixir.bootlin.com/linux/v6.13.7/source/drivers/net/ethernet/xilinx/ll_temac.h#L348
> > > >
> > > > The consensus seems to be + 3.
>
> And shouldn't it be 4 actually? %s [MII_BUS_ID_SIZE] + ':' + '%02x' + nul
>
> > > u16, gcc can't proove the range, it assumes 65536 is the maximum.
> > >
> > > include/linux/phy.h:312:20: note: directive argument in the range [0, 65535]
> >
> > How about after
> >
> > ret = asix_read_phy_addr(dev, priv->use_embdphy);
> > if (ret < 0)
> > goto free;
> >
> > add
> >
> > if (ret > 31) {
> > netdev_err(dev->net, "Invalid PHY ID %d\n", ret);
> > return -ENODEV;
> > }
> >
> > and see if GCC can follow that?
>
> No, with + 3 it doesn't work, need + 4.
>
> Another possibility to change the _FMT to have %02hhx instead of %02x.
>
> Tell me which one should I take?
I'll make a series, because on the second though it seems that fixing
formatting string will fix the other cases at the same time.
--
With Best Regards,
Andy Shevchenko
prev parent reply other threads:[~2025-03-19 10:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-18 16:17 [PATCH net v1 1/1] net: usb: asix: ax88772: Increase phy_name size Andy Shevchenko
2025-03-18 16:49 ` Andrew Lunn
2025-03-18 16:54 ` Andy Shevchenko
2025-03-18 17:09 ` Andrew Lunn
2025-03-19 10:35 ` Andy Shevchenko
2025-03-19 10:49 ` Andy Shevchenko [this message]
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=Z9qhNnnwkMaMCbI1@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.