* [PATCH bpf-next] bpf: Fix unused nskb warning in bpf_icmp_send
@ 2026-07-10 18:09 Mahe Tardy
2026-07-10 19:49 ` Kumar Kartikeya Dwivedi
0 siblings, 1 reply; 2+ messages in thread
From: Mahe Tardy @ 2026-07-10 18:09 UTC (permalink / raw)
To: bpf
Cc: Mahe Tardy, kernel test robot, Alexei Starovoitov,
Daniel Borkmann, Andrii Nakryiko, Eduard Zingerman,
Kumar Kartikeya Dwivedi, Martin KaFai Lau, Song Liu,
Yonghong Song, Jiri Olsa, Emil Tsalapatis, John Fastabend,
Stanislav Fomichev, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, Jordan Rife, netdev, linux-kernel
Declare nskb inside the IPv4 and IPv6 case blocks so it is only present
when the corresponding code is built. The case braces are intentional to
scope the local declarations under the switch labels.
Fixes: f3603df9aebb ("bpf: Add bpf_icmp_send kfunc")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202607110140.JeJZ6GIa-lkp@intel.com/
Signed-off-by: Mahe Tardy <mahe.tardy@gmail.com>
---
net/core/filter.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/net/core/filter.c b/net/core/filter.c
index e4697036c67b..056deb9b3fc3 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -12575,7 +12575,6 @@ __bpf_kfunc int bpf_xdp_pull_data(struct xdp_md *x, u32 len)
__bpf_kfunc int bpf_icmp_send(struct __sk_buff *skb_ctx, int type, int code)
{
struct sk_buff *skb = (struct sk_buff *)skb_ctx;
- struct sk_buff *nskb;
struct sock *sk;
sk = skb_to_full_sk(skb);
@@ -12589,6 +12588,8 @@ __bpf_kfunc int bpf_icmp_send(struct __sk_buff *skb_ctx, int type, int code)
switch (skb->protocol) {
#if IS_ENABLED(CONFIG_INET)
case htons(ETH_P_IP): {
+ struct sk_buff *nskb;
+
if (type != ICMP_DEST_UNREACH)
return -EOPNOTSUPP;
if (code < 0 || code > NR_ICMP_UNREACH ||
@@ -12606,7 +12607,9 @@ __bpf_kfunc int bpf_icmp_send(struct __sk_buff *skb_ctx, int type, int code)
}
#endif
#if IS_ENABLED(CONFIG_IPV6)
- case htons(ETH_P_IPV6):
+ case htons(ETH_P_IPV6): {
+ struct sk_buff *nskb;
+
if (type != ICMPV6_DEST_UNREACH)
return -EOPNOTSUPP;
if (code < 0 || code > ICMPV6_REJECT_ROUTE)
@@ -12620,6 +12623,7 @@ __bpf_kfunc int bpf_icmp_send(struct __sk_buff *skb_ctx, int type, int code)
icmpv6_send(nskb, type, code, 0);
consume_skb(nskb);
break;
+ }
#endif
default:
return -EPROTONOSUPPORT;
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH bpf-next] bpf: Fix unused nskb warning in bpf_icmp_send
2026-07-10 18:09 [PATCH bpf-next] bpf: Fix unused nskb warning in bpf_icmp_send Mahe Tardy
@ 2026-07-10 19:49 ` Kumar Kartikeya Dwivedi
0 siblings, 0 replies; 2+ messages in thread
From: Kumar Kartikeya Dwivedi @ 2026-07-10 19:49 UTC (permalink / raw)
To: Mahe Tardy, bpf
Cc: kernel test robot, Alexei Starovoitov, Daniel Borkmann,
Andrii Nakryiko, Eduard Zingerman, Kumar Kartikeya Dwivedi,
Martin KaFai Lau, Song Liu, Yonghong Song, Jiri Olsa,
Emil Tsalapatis, John Fastabend, Stanislav Fomichev,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, Jordan Rife, netdev, linux-kernel
On Fri Jul 10, 2026 at 8:09 PM CEST, Mahe Tardy wrote:
> Declare nskb inside the IPv4 and IPv6 case blocks so it is only present
> when the corresponding code is built. The case braces are intentional to
> scope the local declarations under the switch labels.
>
> Fixes: f3603df9aebb ("bpf: Add bpf_icmp_send kfunc")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202607110140.JeJZ6GIa-lkp@intel.com/
> Signed-off-by: Mahe Tardy <mahe.tardy@gmail.com>
> ---
pw-bot is asleep, applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-10 19:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-10 18:09 [PATCH bpf-next] bpf: Fix unused nskb warning in bpf_icmp_send Mahe Tardy
2026-07-10 19:49 ` Kumar Kartikeya Dwivedi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox