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: <Z9qhNnnwkMaMCbI1@smile.fi.intel.com>
Date: Wed, 19 Mar 2025 12:49:26 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Andrew Lunn <andrew@...n.ch>
Cc: linux-usb@...r.kernel.org, netdev@...r.kernel.org,
	linux-kernel@...r.kernel.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>
Subject: Re: [PATCH net v1 1/1] net: usb: asix: ax88772: Increase phy_name
 size

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



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ