Skip to content

Commit a5e2da6

Browse files
borkmanndavem330
authored andcommitted
bpf: netdev is never null in __dev_map_flush
No need to test for it in fast-path, every dev in bpf_dtab_netdev is guaranteed to be non-NULL, otherwise dev_map_update_elem() will fail in the first place. Signed-off-by: Daniel Borkmann <[email protected]> Acked-by: Alexei Starovoitov <[email protected]> Acked-by: John Fastabend <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent d2aaa3d commit a5e2da6

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

kernel/bpf/devmap.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -226,12 +226,10 @@ void __dev_map_flush(struct bpf_map *map)
226226
if (unlikely(!dev))
227227
continue;
228228

229-
netdev = dev->dev;
230229
__clear_bit(bit, bitmap);
231-
if (unlikely(!netdev || !netdev->netdev_ops->ndo_xdp_flush))
232-
continue;
233-
234-
netdev->netdev_ops->ndo_xdp_flush(netdev);
230+
netdev = dev->dev;
231+
if (likely(netdev->netdev_ops->ndo_xdp_flush))
232+
netdev->netdev_ops->ndo_xdp_flush(netdev);
235233
}
236234
}
237235

0 commit comments

Comments
 (0)