[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <d8e0306b70b05bdd5e628459863d1027c8c26959.1503537400.git.daniel@iogearbox.net>
Date: Thu, 24 Aug 2017 03:20:11 +0200
From: Daniel Borkmann <daniel@...earbox.net>
To: davem@...emloft.net
Cc: ast@...com, john.fastabend@...il.com, netdev@...r.kernel.org,
Daniel Borkmann <daniel@...earbox.net>
Subject: [PATCH net-next] 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@...earbox.net>
---
kernel/bpf/devmap.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/kernel/bpf/devmap.c b/kernel/bpf/devmap.c
index bfecabf..ecf9f99 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);
}
}
--
1.9.3
Powered by blists - more mailing lists