[PATCH net v5] net: txgbe: fix stack size for PHY interface mask
From: Coia Prant
Date: Tue Nov 17 2026 - 12:55:44 EST
The DECLARE_PHY_INTERFACE_MASK_ZERO() macro currently defined in the
txgbe driver incorrectly uses PHY_INTERFACE_MODE_MAX as the array
length instead of BITS_TO_LONGS(). This allocates significantly more
space on the stack than necessary.
Since hiding the zero-initialization inside a macro is discouraged,
drop the local macro entirely and use the standard
DECLARE_PHY_INTERFACE_MASK() with explicit zero-initialization at the
declaration site instead.
Fixes: 47f848aac4e7 ("net: txgbe: initialize PHY interface to 0")
Signed-off-by: Coia Prant <coiaprant@xxxxxxxxx>
Cc: Jiawen Wu <jiawenwu@xxxxxxxxxxxxxx>
---
Changes since v4:
- replace DECLARE_PHY_INTERFACE_MASK_ZERO with DECLARE_PHY_INTERFACE_MASK and initialize it to { 0, }.
Links:
- https://lore.kernel.org/all/20261102212506.3348537-1-coiaprant@xxxxxxxxx/ (v3)
- https://lore.kernel.org/all/20261110160554.918652-1-coiaprant@xxxxxxxxx/ (v4)
drivers/net/ethernet/wangxun/txgbe/txgbe_aml.c | 4 ++--
drivers/net/ethernet/wangxun/txgbe/txgbe_type.h | 3 ---
2 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/wangxun/txgbe/txgbe_aml.c b/drivers/net/ethernet/wangxun/txgbe/txgbe_aml.c
index 26d0cfc58ee2..a21bc55c39ed 100644
--- a/drivers/net/ethernet/wangxun/txgbe/txgbe_aml.c
+++ b/drivers/net/ethernet/wangxun/txgbe/txgbe_aml.c
@@ -202,7 +202,7 @@ void txgbe_set_phy_link(struct wx *wx)
static int txgbe_sfp_to_linkmodes(struct wx *wx, struct txgbe_sff_id *id)
{
__ETHTOOL_DECLARE_LINK_MODE_MASK(modes) = { 0, };
- DECLARE_PHY_INTERFACE_MASK_ZERO(interfaces);
+ DECLARE_PHY_INTERFACE_MASK(interfaces) = { 0, };
struct txgbe *txgbe = wx->priv;
if (id->cable_tech & TXGBE_SFF_DA_PASSIVE_CABLE) {
@@ -269,7 +269,7 @@ static int txgbe_sfp_to_linkmodes(struct wx *wx, struct txgbe_sff_id *id)
static int txgbe_qsfp_to_linkmodes(struct wx *wx, struct txgbe_sff_id *id)
{
__ETHTOOL_DECLARE_LINK_MODE_MASK(modes) = { 0, };
- DECLARE_PHY_INTERFACE_MASK_ZERO(interfaces);
+ DECLARE_PHY_INTERFACE_MASK(interfaces) = { 0, };
struct txgbe *txgbe = wx->priv;
if (id->transceiver_type & TXGBE_SFF_ETHERNET_40G_CR4) {
diff --git a/drivers/net/ethernet/wangxun/txgbe/txgbe_type.h b/drivers/net/ethernet/wangxun/txgbe/txgbe_type.h
index 757d1ce8d3ad..8071464c7b90 100644
--- a/drivers/net/ethernet/wangxun/txgbe/txgbe_type.h
+++ b/drivers/net/ethernet/wangxun/txgbe/txgbe_type.h
@@ -315,9 +315,6 @@ void txgbe_up(struct wx *wx);
int txgbe_setup_tc(struct net_device *dev, u8 tc);
void txgbe_do_reset(struct net_device *netdev, bool reinit);
-#define DECLARE_PHY_INTERFACE_MASK_ZERO(name) \
- unsigned long name[PHY_INTERFACE_MODE_MAX] = { 0, }
-
#define TXGBE_LINK_SPEED_UNKNOWN 0
#define TXGBE_LINK_SPEED_10GB_FULL 4
#define TXGBE_LINK_SPEED_25GB_FULL 0x10
--
2.47.3