[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z9qp6F26PbNczz9R@smile.fi.intel.com>
Date: Wed, 19 Mar 2025 13:26:32 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: linux-usb@...r.kernel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: 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>,
Heiner Kallweit <hkallweit1@...il.com>,
Russell King <linux@...linux.org.uk>
Subject: Re: [PATCH net v2 2/2] net: usb: asix: ax88772: Increase phy_name
size
On Wed, Mar 19, 2025 at 12:54:34PM +0200, Andy Shevchenko wrote:
> GCC compiler (Debian 14.2.0-17) is not happy about printing
> into a short buffer (when build with `make W=1`):
>
> drivers/net/usb/ax88172a.c: In function ‘ax88172a_reset’:
> include/linux/phy.h:312:20: error: ‘%s’ directive output may be truncated writing up to 60 bytes into a region of size 20 [-Werror=format-truncation=]
>
> Indeed, the buffer size is chosen based on some assumptions, while
> in general the assigned name might not fit. Increase the buffer to
> cover maximum length of the parameters. With that, change snprintf()
> to use sizeof() instead of hard coded number.
...
> if (ret < 0)
> goto free;
> -
> + if (ret >= PHY_MAX_ADDR) {
> + netdev_err(dev->net, "Invalid PHY ID %x\n", ret);
> + return -ENODEV;
Oh, I was blindly put what had been suggested, needs a fix, but I will wait for
other comments if any before issuing a v3.
> + }
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists