]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
bpf: netdev is never null in __dev_map_flush
authorDaniel Borkmann <daniel@iogearbox.net>
Thu, 24 Aug 2017 01:20:11 +0000 (03:20 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 24 Aug 2017 05:43:40 +0000 (22:43 -0700)
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>
kernel/bpf/devmap.c

index bfecabfd4974d73a5e42ed3ddcded3f23cd56a9b..ecf9f99ecc579e315f4651032a8b39415d5b4d81 100644 (file)
@@ -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);
        }
 }