Skip to content

Commit

Permalink
bpf, devmap: Remove unnecessary if check in for loop
Browse files Browse the repository at this point in the history
The iterator variable dst cannot be NULL and the if check can be removed.
Remove it and fix the following Coccinelle/coccicheck warning reported
by itnull.cocci:

	ERROR: iterator variable bound on line 762 cannot be NULL

Signed-off-by: Thorsten Blum <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
Reviewed-by: Toke Høiland-Jørgensen <[email protected]>
Acked-by: Jiri Olsa <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
  • Loading branch information
toblux authored and borkmann committed Jun 3, 2024
1 parent 7d0b395 commit 2317dc2
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions kernel/bpf/devmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -760,9 +760,6 @@ int dev_map_redirect_multi(struct net_device *dev, struct sk_buff *skb,
for (i = 0; i < dtab->n_buckets; i++) {
head = dev_map_index_hash(dtab, i);
hlist_for_each_entry_safe(dst, next, head, index_hlist) {
if (!dst)
continue;

if (is_ifindex_excluded(excluded_devices, num_excluded,
dst->dev->ifindex))
continue;
Expand Down

0 comments on commit 2317dc2

Please sign in to comment.