diff options
author | Daniel Borkmann <daniel@iogearbox.net> | 2017-08-24 04:20:11 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-08-24 08:43:40 +0300 |
commit | a5e2da6e9787187ff104c34aa048419703c1f9cb (patch) | |
tree | 57c9516ecbf16f502b3128e4c131cb3f2b425c46 /kernel/bpf/devmap.c | |
parent | d2aaa3dc419994eefa21de971bb1f544c42541c7 (diff) | |
download | linux-a5e2da6e9787187ff104c34aa048419703c1f9cb.tar.xz |
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 <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'kernel/bpf/devmap.c')
-rw-r--r-- | kernel/bpf/devmap.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/kernel/bpf/devmap.c b/kernel/bpf/devmap.c index bfecabfd4974..ecf9f99ecc57 100644 --- a/kernel/bpf/devmap.c +++ b/kernel/bpf/devmap.c @@ -226,12 +226,10 @@ void __dev_map_flush(struct bpf_map *map) if (unlikely(!dev)) continue; - netdev = dev->dev; __clear_bit(bit, bitmap); - if (unlikely(!netdev || !netdev->netdev_ops->ndo_xdp_flush)) - continue; - - netdev->netdev_ops->ndo_xdp_flush(netdev); + netdev = dev->dev; + if (likely(netdev->netdev_ops->ndo_xdp_flush)) + netdev->netdev_ops->ndo_xdp_flush(netdev); } } |