diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 87fc8332898742a37c1d5d7d865bf61adb8a8fd3..dc52d8b57b2f33b11a648d25b034b9bed3b415b0 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -5346,6 +5346,12 @@ do { \ }) #endif +#if defined(CONFIG_DEBUG_NET) +#define DEBUG_NET_WARN_ON_ONCE(cond) (void)WARN_ON_ONCE(cond) +#else +#define DEBUG_NET_WARN_ON_ONCE(cond) BUILD_BUG_ON_INVALID(cond) +#endif + /* * The list of packet types we will receive (as opposed to discard) * and the routines to invoke. diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c index 18f29cedb2b9e79bad51fa1c35219e56a6e03570..4280164a40ecb74827faf6dc27bebe94b8a68eec 100644 --- a/net/core/flow_dissector.c +++ b/net/core/flow_dissector.c @@ -972,7 +972,7 @@ bool __skb_flow_dissect(const struct net *net, } } - WARN_ON_ONCE(!net); + DEBUG_NET_WARN_ON_ONCE(!net); if (net) { enum netns_bpf_attach_type type = NETNS_BPF_FLOW_DISSECTOR; struct bpf_prog_array *run_array;