715-29-v6.4-net-pcs-xpcs-fix-incorrect-number-of-interfaces.patch 1.2 KB

123456789101112131415161718192021222324252627282930
  1. From 43fb622d91a9f408322735d2f736495c1009f575 Mon Sep 17 00:00:00 2001
  2. From: "Russell King (Oracle)" <[email protected]>
  3. Date: Tue, 9 May 2023 12:50:04 +0100
  4. Subject: [PATCH] net: pcs: xpcs: fix incorrect number of interfaces
  5. In synopsys_xpcs_compat[], the DW_XPCS_2500BASEX entry was setting
  6. the number of interfaces using the xpcs_2500basex_features array
  7. rather than xpcs_2500basex_interfaces. This causes us to overflow
  8. the array of interfaces. Fix this.
  9. Fixes: f27abde3042a ("net: pcs: add 2500BASEX support for Intel mGbE controller")
  10. Signed-off-by: Russell King (Oracle) <[email protected]>
  11. Reviewed-by: Andrew Lunn <[email protected]>
  12. Reviewed-by: Leon Romanovsky <[email protected]>
  13. Signed-off-by: David S. Miller <[email protected]>
  14. ---
  15. drivers/net/pcs/pcs-xpcs.c | 2 +-
  16. 1 file changed, 1 insertion(+), 1 deletion(-)
  17. --- a/drivers/net/pcs/pcs-xpcs.c
  18. +++ b/drivers/net/pcs/pcs-xpcs.c
  19. @@ -1211,7 +1211,7 @@ static const struct xpcs_compat synopsys
  20. [DW_XPCS_2500BASEX] = {
  21. .supported = xpcs_2500basex_features,
  22. .interface = xpcs_2500basex_interfaces,
  23. - .num_interfaces = ARRAY_SIZE(xpcs_2500basex_features),
  24. + .num_interfaces = ARRAY_SIZE(xpcs_2500basex_interfaces),
  25. .an_mode = DW_2500BASEX,
  26. },
  27. };