Re: [PATCH net v1 1/1] net: usb: asix: ax88772: Increase phy_name size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
> 
> 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?

	Andrew




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux