From: kernel test robot <lkp@intel.com>
To: Mahe Tardy <mahe.tardy@gmail.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
Daniel Borkmann <daniel@iogearbox.net>,
Emil Tsalapatis <emil@etsalapatis.com>,
Jordan Rife <jordan@jrife.io>
Subject: [linux-next:master 5404/5655] net/core/filter.c:12578:18: warning: unused variable 'nskb'
Date: Sat, 11 Jul 2026 01:37:50 +0800 [thread overview]
Message-ID: <202607110140.JeJZ6GIa-lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: bee763d5f341b99cf472afeb508d4988f62a6ca1
commit: f3603df9aebb2a2fe2f745bd71ca38aeca60e6e7 [5404/5655] bpf: Add bpf_icmp_send kfunc
config: i386-buildonly-randconfig-001-20260710 (https://download.01.org/0day-ci/archive/20260711/202607110140.JeJZ6GIa-lkp@intel.com/config)
compiler: clang version 22.1.3 (https://github.com/llvm/llvm-project e9846648fd6183ee6d8cbdb4502213fcf902a211)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260711/202607110140.JeJZ6GIa-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202607110140.JeJZ6GIa-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> net/core/filter.c:12578:18: warning: unused variable 'nskb' [-Wunused-variable]
12578 | struct sk_buff *nskb;
| ^~~~
1 warning generated.
vim +/nskb +12578 net/core/filter.c
12553
12554 /**
12555 * bpf_icmp_send - Send an ICMP control message
12556 * @skb_ctx: Packet that triggered the control message
12557 * @type: ICMP type (only ICMP_DEST_UNREACH/ICMPV6_DEST_UNREACH supported)
12558 * @code: ICMP code (0-15 except ICMP_FRAG_NEEDED for IPv4, 0-6 for IPv6)
12559 *
12560 * Sends an ICMP control message in response to the packet. The original packet
12561 * is cloned before sending the ICMP message, so the BPF program can still let
12562 * the packet pass if desired.
12563 *
12564 * Currently only ICMP_DEST_UNREACH (IPv4) and ICMPV6_DEST_UNREACH (IPv6) are
12565 * supported.
12566 *
12567 * Return: 0 on success (send attempt), negative error code on failure:
12568 * -EBUSY: Recursion detected
12569 * -EPROTONOSUPPORT: Non-IP protocol
12570 * -EOPNOTSUPP: Unsupported ICMP type
12571 * -EINVAL: Invalid code parameter
12572 * -ENETUNREACH: No usable route/dst for the ICMP reply
12573 * -ENOMEM: Memory allocation failed
12574 */
12575 __bpf_kfunc int bpf_icmp_send(struct __sk_buff *skb_ctx, int type, int code)
12576 {
12577 struct sk_buff *skb = (struct sk_buff *)skb_ctx;
12578 struct sk_buff *nskb;
12579 struct sock *sk;
12580
12581 sk = skb_to_full_sk(skb);
12582 if (sk && sk->sk_kern_sock &&
12583 (sk->sk_protocol == IPPROTO_ICMP || sk->sk_protocol == IPPROTO_ICMPV6))
12584 return -EBUSY;
12585
12586 if (!skb_valid_dst(skb))
12587 return -ENETUNREACH;
12588
12589 switch (skb->protocol) {
12590 #if IS_ENABLED(CONFIG_INET)
12591 case htons(ETH_P_IP): {
12592 if (type != ICMP_DEST_UNREACH)
12593 return -EOPNOTSUPP;
12594 if (code < 0 || code > NR_ICMP_UNREACH ||
12595 code == ICMP_FRAG_NEEDED) /* needs a valid next-hop MTU */
12596 return -EINVAL;
12597
12598 nskb = skb_clone(skb, GFP_ATOMIC);
12599 if (!nskb)
12600 return -ENOMEM;
12601
12602 memset(IPCB(nskb), 0, sizeof(*IPCB(nskb)));
12603 icmp_send(nskb, type, code, 0);
12604 consume_skb(nskb);
12605 break;
12606 }
12607 #endif
12608 #if IS_ENABLED(CONFIG_IPV6)
12609 case htons(ETH_P_IPV6):
12610 if (type != ICMPV6_DEST_UNREACH)
12611 return -EOPNOTSUPP;
12612 if (code < 0 || code > ICMPV6_REJECT_ROUTE)
12613 return -EINVAL;
12614
12615 nskb = skb_clone(skb, GFP_ATOMIC);
12616 if (!nskb)
12617 return -ENOMEM;
12618
12619 memset(IP6CB(nskb), 0, sizeof(*IP6CB(nskb)));
12620 icmpv6_send(nskb, type, code, 0);
12621 consume_skb(nskb);
12622 break;
12623 #endif
12624 default:
12625 return -EPROTONOSUPPORT;
12626 }
12627
12628 return 0;
12629 }
12630
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next reply other threads:[~2026-07-10 17:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-10 17:37 kernel test robot [this message]
2026-07-11 11:15 ` [linux-next:master 5404/5655] net/core/filter.c:12578:18: warning: unused variable 'nskb' Daniel Borkmann
2026-07-11 12:18 ` Mahe Tardy
2026-07-11 12:23 ` Daniel Borkmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202607110140.JeJZ6GIa-lkp@intel.com \
--to=lkp@intel.com \
--cc=daniel@iogearbox.net \
--cc=emil@etsalapatis.com \
--cc=jordan@jrife.io \
--cc=llvm@lists.linux.dev \
--cc=mahe.tardy@gmail.com \
--cc=oe-kbuild-all@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.