Re: [PATCH net v2 1/2] net: phy: Fix formatting specifier to avoid potential string cuts
From: Andy Shevchenko
Date: Wed Mar 19 2025 - 07:22:16 EST
On Wed, Mar 19, 2025 at 12:54:33PM +0200, Andy Shevchenko wrote:
> The PHY_ID_FMT is defined with '%02x' which is _minumum_ digits
> to be printed. This, in particular, may trigger GCC warning, when
> the parameter for the above mentioned specifier is bigger than
> a byte. Avoid this, by limiting the amount of digits to be printed
> to two. This is okay as the PHY maximum address is 31 and it fits.
For the curious: additional reading in the commit
46d57a7a8e33 ("docs: printk-formats: Fix hex printing of signed values").
--
With Best Regards,
Andy Shevchenko