Skip to content

Commit f6bf1ba

Browse files
idoschdavem330
authored andcommitted
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: c011ec1 ("mlxsw: spectrum: Add the multicast routing offloading logic") Signed-off-by: Ido Schimmel <[email protected]> Reviewed-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent bcaeb88 commit f6bf1ba

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/net/ethernet/mellanox/mlxsw/spectrum_mr.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -637,12 +637,12 @@ static int mlxsw_sp_mr_vif_resolve(struct mlxsw_sp_mr_table *mr_table,
637637
return 0;
638638

639639
err_erif_unresolve:
640-
list_for_each_entry_from_reverse(erve, &mr_vif->route_evif_list,
641-
vif_node)
640+
list_for_each_entry_continue_reverse(erve, &mr_vif->route_evif_list,
641+
vif_node)
642642
mlxsw_sp_mr_route_evif_unresolve(mr_table, erve);
643643
err_irif_unresolve:
644-
list_for_each_entry_from_reverse(irve, &mr_vif->route_ivif_list,
645-
vif_node)
644+
list_for_each_entry_continue_reverse(irve, &mr_vif->route_ivif_list,
645+
vif_node)
646646
mlxsw_sp_mr_route_ivif_unresolve(mr_table, irve);
647647
mr_vif->rif = NULL;
648648
return err;

0 commit comments

Comments
 (0)