764-03-v5.17-net-next-net-dsa-qca8k-remove-redundant-check-in-parse_port_config.patch 1.1 KB

1234567891011121314151617181920212223242526272829
  1. From b9133f3ef5a2659730cf47a74bd0a9259f1cf8ff Mon Sep 17 00:00:00 2001
  2. From: Ansuel Smith <[email protected]>
  3. Date: Mon, 22 Nov 2021 16:23:40 +0100
  4. Subject: net: dsa: qca8k: remove redundant check in parse_port_config
  5. The very next check for port 0 and 6 already makes sure we don't go out
  6. of bounds with the ports_config delay table.
  7. Remove the redundant check.
  8. Reported-by: kernel test robot <[email protected]>
  9. Reported-by: Dan Carpenter <[email protected]>
  10. Signed-off-by: Ansuel Smith <[email protected]>
  11. Reviewed-by: Vladimir Oltean <[email protected]>
  12. Signed-off-by: David S. Miller <[email protected]>
  13. ---
  14. drivers/net/dsa/qca8k.c | 2 +-
  15. 1 file changed, 1 insertion(+), 1 deletion(-)
  16. --- a/drivers/net/dsa/qca8k.c
  17. +++ b/drivers/net/dsa/qca8k.c
  18. @@ -983,7 +983,7 @@ qca8k_parse_port_config(struct qca8k_pri
  19. u32 delay;
  20. /* We have 2 CPU port. Check them */
  21. - for (port = 0; port < QCA8K_NUM_PORTS && cpu_port_index < QCA8K_NUM_CPU_PORTS; port++) {
  22. + for (port = 0; port < QCA8K_NUM_PORTS; port++) {
  23. /* Skip every other port */
  24. if (port != 0 && port != 6)
  25. continue;