]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: txgbe: initialize PHY interface to 0
authorJiawen Wu <jiawenwu@trustnetic.com>
Mon, 8 Jun 2026 07:08:42 +0000 (15:08 +0800)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 11 Jun 2026 08:55:14 +0000 (10:55 +0200)
DECLARE_PHY_INTERFACE_MASK() does not guarantee zeroed contents. Add a
new macro DECLARE_PHY_INTERFACE_MASK_ZERO(), make the stack variable to
be zeroed before setting supported interfaces.

Fixes: 57d39faed4c9 ("net: txgbe: improve functions of AML 40G devices")
Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
Link: https://patch.msgid.link/20260608070842.36504-4-jiawenwu@trustnetic.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/wangxun/txgbe/txgbe_aml.c
drivers/net/ethernet/wangxun/txgbe/txgbe_type.h

index bdac654a236465de5ee5d66003869fa7170e53c6..8fc32df8e49a446bacc61665b4dfb25400cf61ca 100644 (file)
@@ -204,7 +204,7 @@ int 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(interfaces);
+       DECLARE_PHY_INTERFACE_MASK_ZERO(interfaces);
        struct txgbe *txgbe = wx->priv;
 
        if (id->cable_tech & TXGBE_SFF_DA_PASSIVE_CABLE) {
@@ -271,7 +271,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(interfaces);
+       DECLARE_PHY_INTERFACE_MASK_ZERO(interfaces);
        struct txgbe *txgbe = wx->priv;
 
        if (id->transceiver_type & TXGBE_SFF_ETHERNET_40G_CR4) {
index 6b05f32b4a0109e3fa1f8a74c1b9f8836318bdff..877234e3fdc2b62578adb9fa61653bd4b28eb3ab 100644 (file)
@@ -315,6 +315,9 @@ void txgbe_up(struct wx *wx);
 int txgbe_setup_tc(struct net_device *dev, u8 tc);
 void txgbe_do_reset(struct net_device *netdev);
 
+#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