net: pcs: xpcs: fix incorrect number of interfaces
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Tue, 9 May 2023 11:50:04 +0000 (12:50 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 10 May 2023 09:25:02 +0000 (10:25 +0100)
In synopsys_xpcs_compat[], the DW_XPCS_2500BASEX entry was setting
the number of interfaces using the xpcs_2500basex_features array
rather than xpcs_2500basex_interfaces. This causes us to overflow
the array of interfaces. Fix this.

Fixes: f27abde3042a ("net: pcs: add 2500BASEX support for Intel mGbE controller")
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/pcs/pcs-xpcs.c

index 539cd43eae8d3e532ab551e317f855f429690fa5..f19d48c94fe0e9ccd66c3a7c451268af7d713248 100644 (file)
@@ -1203,7 +1203,7 @@ static const struct xpcs_compat synopsys_xpcs_compat[DW_XPCS_INTERFACE_MAX] = {
        [DW_XPCS_2500BASEX] = {
                .supported = xpcs_2500basex_features,
                .interface = xpcs_2500basex_interfaces,
-               .num_interfaces = ARRAY_SIZE(xpcs_2500basex_features),
+               .num_interfaces = ARRAY_SIZE(xpcs_2500basex_interfaces),
                .an_mode = DW_2500BASEX,
        },
 };