[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250319105813.3102076-2-andriy.shevchenko@linux.intel.com>
Date: Wed, 19 Mar 2025 12:54:33 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
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: [PATCH net v2 1/2] net: phy: Fix formatting specifier to avoid potential string cuts
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.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
---
include/linux/phy.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 19f076a71f94..3b18c241f33e 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -309,7 +309,7 @@ static inline long rgmii_clock(int speed)
#define PHY_MAX_ADDR 32
/* Used when trying to connect to a specific phy (mii bus id:phy device id) */
-#define PHY_ID_FMT "%s:%02x"
+#define PHY_ID_FMT "%s:%02hhx"
#define MII_BUS_ID_SIZE 61
--
2.47.2
Powered by blists - more mailing lists