]> git.baikalelectronics.ru Git - kernel.git/commit
mlxsw: spectrum_mr: Fix list iteration in error path
authorIdo Schimmel <idosch@mellanox.com>
Thu, 26 Mar 2020 14:17:33 +0000 (16:17 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 26 Mar 2020 19:00:45 +0000 (12:00 -0700)
commit4e3904e05323cacf94a1dc7deec81742f9276a97
treea97018f01d8455c003603762e61fd249b98a0e5e
parent117b0fd81c1b2460a0b691493fa159ced2170776
mlxsw: spectrum_mr: Fix list iteration in error path

list_for_each_entry_from_reverse() iterates backwards over the list from
the current position, but in the error path we should start from the
previous position.

Fix this by using list_for_each_entry_continue_reverse() instead.

This suppresses the following error from coccinelle:

drivers/net/ethernet/mellanox/mlxsw//spectrum_mr.c:655:34-38: ERROR:
invalid reference to the index variable of the iterator on line 636

Fixes: 7b29ed8aec47 ("mlxsw: spectrum: Add the multicast routing offloading logic")
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/spectrum_mr.c