All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: Re: [PATCH v4 2/2] audit: include source and destination ports to NETFILTER_PKT
Date: Sun, 2 Nov 2025 09:25:53 +0800	[thread overview]
Message-ID: <202511020905.3A5Sbhb2-lkp@intel.com> (raw)

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <6ac2baf0d5ae176cbd3279a4dff9e2c7750c6d45.1761918165.git.rrobaina@redhat.com>
References: <6ac2baf0d5ae176cbd3279a4dff9e2c7750c6d45.1761918165.git.rrobaina@redhat.com>
TO: Ricardo Robaina <rrobaina@redhat.com>
TO: audit@vger.kernel.org
TO: linux-kernel@vger.kernel.org
TO: netfilter-devel@vger.kernel.org
TO: coreteam@netfilter.org
CC: paul@paul-moore.com
CC: eparis@redhat.com
CC: fw@strlen.de
CC: pablo@netfilter.org
CC: kadlec@netfilter.org
CC: Ricardo Robaina <rrobaina@redhat.com>

Hi Ricardo,

kernel test robot noticed the following build warnings:

[auto build test WARNING on pcmoore-audit/next]
[also build test WARNING on netfilter-nf/main linus/master v6.18-rc3 next-20251031]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Ricardo-Robaina/audit-add-audit_log_packet_ip4-and-audit_log_packet_ip6-helper-functions/20251031-220605
base:   https://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/audit.git next
patch link:    https://lore.kernel.org/r/6ac2baf0d5ae176cbd3279a4dff9e2c7750c6d45.1761918165.git.rrobaina%40redhat.com
patch subject: [PATCH v4 2/2] audit: include source and destination ports to NETFILTER_PKT
:::::: branch date: 35 hours ago
:::::: commit date: 35 hours ago
config: i386-randconfig-141-20251102 (https://download.01.org/0day-ci/archive/20251102/202511020905.3A5Sbhb2-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0

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>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202511020905.3A5Sbhb2-lkp@intel.com/

smatch warnings:
kernel/audit.c:2555 audit_log_packet_ip4() warn: statement has no effect 'struct'
kernel/audit.c:2616 audit_log_packet_ip6() warn: statement has no effect 'struct'

vim +/struct +2555 kernel/audit.c

4b7d248b3a1de4 Richard Guy Briggs 2019-01-22  2543  
3280a1e8d8a110 Ricardo Robaina    2025-10-31  2544  bool audit_log_packet_ip4(struct audit_buffer *ab, struct sk_buff *skb)
3280a1e8d8a110 Ricardo Robaina    2025-10-31  2545  {
3280a1e8d8a110 Ricardo Robaina    2025-10-31  2546  	struct iphdr _iph;
3280a1e8d8a110 Ricardo Robaina    2025-10-31  2547  	const struct iphdr *ih;
3280a1e8d8a110 Ricardo Robaina    2025-10-31  2548  
3280a1e8d8a110 Ricardo Robaina    2025-10-31  2549  	ih = skb_header_pointer(skb, skb_network_offset(skb), sizeof(_iph), &_iph);
3280a1e8d8a110 Ricardo Robaina    2025-10-31  2550  	if (!ih)
3280a1e8d8a110 Ricardo Robaina    2025-10-31  2551  		return false;
3280a1e8d8a110 Ricardo Robaina    2025-10-31  2552  
3139583951cf29 Ricardo Robaina    2025-10-31  2553  	switch (ih->protocol) {
3139583951cf29 Ricardo Robaina    2025-10-31  2554  	case IPPROTO_TCP:
3139583951cf29 Ricardo Robaina    2025-10-31 @2555  		struct tcphdr _tcph;
3139583951cf29 Ricardo Robaina    2025-10-31  2556  		const struct tcphdr *th;
3139583951cf29 Ricardo Robaina    2025-10-31  2557  
3139583951cf29 Ricardo Robaina    2025-10-31  2558  		th = skb_header_pointer(skb, skb_transport_offset(skb), sizeof(_tcph), &_tcph);
3139583951cf29 Ricardo Robaina    2025-10-31  2559  		if (!th)
3139583951cf29 Ricardo Robaina    2025-10-31  2560  			return false;
3139583951cf29 Ricardo Robaina    2025-10-31  2561  
3139583951cf29 Ricardo Robaina    2025-10-31  2562  		audit_log_format(ab, " saddr=%pI4 daddr=%pI4 proto=%hhu sport=%hu dport=%hu",
3139583951cf29 Ricardo Robaina    2025-10-31  2563  				 &ih->saddr, &ih->daddr, ih->protocol,
3139583951cf29 Ricardo Robaina    2025-10-31  2564  				 ntohs(th->source), ntohs(th->dest));
3139583951cf29 Ricardo Robaina    2025-10-31  2565  		break;
3139583951cf29 Ricardo Robaina    2025-10-31  2566  	case IPPROTO_UDP:
3139583951cf29 Ricardo Robaina    2025-10-31  2567  	case IPPROTO_UDPLITE:
3139583951cf29 Ricardo Robaina    2025-10-31  2568  		struct udphdr _udph;
3139583951cf29 Ricardo Robaina    2025-10-31  2569  		const struct udphdr *uh;
3139583951cf29 Ricardo Robaina    2025-10-31  2570  
3139583951cf29 Ricardo Robaina    2025-10-31  2571  		uh = skb_header_pointer(skb, skb_transport_offset(skb), sizeof(_udph), &_udph);
3139583951cf29 Ricardo Robaina    2025-10-31  2572  		if (!uh)
3139583951cf29 Ricardo Robaina    2025-10-31  2573  			return false;
3139583951cf29 Ricardo Robaina    2025-10-31  2574  
3139583951cf29 Ricardo Robaina    2025-10-31  2575  		audit_log_format(ab, " saddr=%pI4 daddr=%pI4 proto=%hhu sport=%hu dport=%hu",
3139583951cf29 Ricardo Robaina    2025-10-31  2576  				 &ih->saddr, &ih->daddr, ih->protocol,
3139583951cf29 Ricardo Robaina    2025-10-31  2577  				 ntohs(uh->source), ntohs(uh->dest));
3139583951cf29 Ricardo Robaina    2025-10-31  2578  		break;
3139583951cf29 Ricardo Robaina    2025-10-31  2579  	case IPPROTO_SCTP:
3139583951cf29 Ricardo Robaina    2025-10-31  2580  		struct sctphdr _sctph;
3139583951cf29 Ricardo Robaina    2025-10-31  2581  		const struct sctphdr *sh;
3139583951cf29 Ricardo Robaina    2025-10-31  2582  
3139583951cf29 Ricardo Robaina    2025-10-31  2583  		sh = skb_header_pointer(skb, skb_transport_offset(skb), sizeof(_sctph), &_sctph);
3139583951cf29 Ricardo Robaina    2025-10-31  2584  		if (!sh)
3139583951cf29 Ricardo Robaina    2025-10-31  2585  			return false;
3139583951cf29 Ricardo Robaina    2025-10-31  2586  
3139583951cf29 Ricardo Robaina    2025-10-31  2587  		audit_log_format(ab, " saddr=%pI4 daddr=%pI4 proto=%hhu sport=%hu dport=%hu",
3139583951cf29 Ricardo Robaina    2025-10-31  2588  				 &ih->saddr, &ih->daddr, ih->protocol,
3139583951cf29 Ricardo Robaina    2025-10-31  2589  				 ntohs(sh->source), ntohs(sh->dest));
3139583951cf29 Ricardo Robaina    2025-10-31  2590  		break;
3139583951cf29 Ricardo Robaina    2025-10-31  2591  	default:
3280a1e8d8a110 Ricardo Robaina    2025-10-31  2592  		audit_log_format(ab, " saddr=%pI4 daddr=%pI4 proto=%hhu",
3280a1e8d8a110 Ricardo Robaina    2025-10-31  2593  				 &ih->saddr, &ih->daddr, ih->protocol);
3139583951cf29 Ricardo Robaina    2025-10-31  2594  	}
3280a1e8d8a110 Ricardo Robaina    2025-10-31  2595  
3280a1e8d8a110 Ricardo Robaina    2025-10-31  2596  	return true;
3280a1e8d8a110 Ricardo Robaina    2025-10-31  2597  }
3280a1e8d8a110 Ricardo Robaina    2025-10-31  2598  EXPORT_SYMBOL(audit_log_packet_ip4);
3280a1e8d8a110 Ricardo Robaina    2025-10-31  2599  
3280a1e8d8a110 Ricardo Robaina    2025-10-31  2600  bool audit_log_packet_ip6(struct audit_buffer *ab, struct sk_buff *skb)
3280a1e8d8a110 Ricardo Robaina    2025-10-31  2601  {
3280a1e8d8a110 Ricardo Robaina    2025-10-31  2602  	struct ipv6hdr _ip6h;
3280a1e8d8a110 Ricardo Robaina    2025-10-31  2603  	const struct ipv6hdr *ih;
3280a1e8d8a110 Ricardo Robaina    2025-10-31  2604  	u8 nexthdr;
3280a1e8d8a110 Ricardo Robaina    2025-10-31  2605  	__be16 frag_off;
3280a1e8d8a110 Ricardo Robaina    2025-10-31  2606  
3280a1e8d8a110 Ricardo Robaina    2025-10-31  2607  	ih = skb_header_pointer(skb, skb_network_offset(skb), sizeof(_ip6h), &_ip6h);
3280a1e8d8a110 Ricardo Robaina    2025-10-31  2608  	if (!ih)
3280a1e8d8a110 Ricardo Robaina    2025-10-31  2609  		return false;
3280a1e8d8a110 Ricardo Robaina    2025-10-31  2610  
3280a1e8d8a110 Ricardo Robaina    2025-10-31  2611  	nexthdr = ih->nexthdr;
3280a1e8d8a110 Ricardo Robaina    2025-10-31  2612  	ipv6_skip_exthdr(skb, skb_network_offset(skb) + sizeof(_ip6h), &nexthdr, &frag_off);
3280a1e8d8a110 Ricardo Robaina    2025-10-31  2613  
3139583951cf29 Ricardo Robaina    2025-10-31  2614  	switch (nexthdr) {
3139583951cf29 Ricardo Robaina    2025-10-31  2615  	case IPPROTO_TCP:
3139583951cf29 Ricardo Robaina    2025-10-31 @2616  		struct tcphdr _tcph;
3139583951cf29 Ricardo Robaina    2025-10-31  2617  		const struct tcphdr *th;
3139583951cf29 Ricardo Robaina    2025-10-31  2618  
3139583951cf29 Ricardo Robaina    2025-10-31  2619  		th = skb_header_pointer(skb, skb_transport_offset(skb), sizeof(_tcph), &_tcph);
3139583951cf29 Ricardo Robaina    2025-10-31  2620  		if (!th)
3139583951cf29 Ricardo Robaina    2025-10-31  2621  			return false;
3139583951cf29 Ricardo Robaina    2025-10-31  2622  
3139583951cf29 Ricardo Robaina    2025-10-31  2623  		audit_log_format(ab, " saddr=%pI6c daddr=%pI6c proto=%hhu sport=%hu dport=%hu",
3139583951cf29 Ricardo Robaina    2025-10-31  2624  				 &ih->saddr, &ih->daddr, nexthdr,
3139583951cf29 Ricardo Robaina    2025-10-31  2625  				 ntohs(th->source), ntohs(th->dest));
3139583951cf29 Ricardo Robaina    2025-10-31  2626  		break;
3139583951cf29 Ricardo Robaina    2025-10-31  2627  	case IPPROTO_UDP:
3139583951cf29 Ricardo Robaina    2025-10-31  2628  	case IPPROTO_UDPLITE:
3139583951cf29 Ricardo Robaina    2025-10-31  2629  		struct udphdr _udph;
3139583951cf29 Ricardo Robaina    2025-10-31  2630  		const struct udphdr *uh;
3139583951cf29 Ricardo Robaina    2025-10-31  2631  
3139583951cf29 Ricardo Robaina    2025-10-31  2632  		uh = skb_header_pointer(skb, skb_transport_offset(skb), sizeof(_udph), &_udph);
3139583951cf29 Ricardo Robaina    2025-10-31  2633  		if (!uh)
3139583951cf29 Ricardo Robaina    2025-10-31  2634  			return false;
3139583951cf29 Ricardo Robaina    2025-10-31  2635  
3139583951cf29 Ricardo Robaina    2025-10-31  2636  		audit_log_format(ab, " saddr=%pI6c daddr=%pI6c proto=%hhu sport=%hu dport=%hu",
3139583951cf29 Ricardo Robaina    2025-10-31  2637  				 &ih->saddr, &ih->daddr, nexthdr,
3139583951cf29 Ricardo Robaina    2025-10-31  2638  				 ntohs(uh->source), ntohs(uh->dest));
3139583951cf29 Ricardo Robaina    2025-10-31  2639  		break;
3139583951cf29 Ricardo Robaina    2025-10-31  2640  	case IPPROTO_SCTP:
3139583951cf29 Ricardo Robaina    2025-10-31  2641  		struct sctphdr _sctph;
3139583951cf29 Ricardo Robaina    2025-10-31  2642  		const struct sctphdr *sh;
3139583951cf29 Ricardo Robaina    2025-10-31  2643  
3139583951cf29 Ricardo Robaina    2025-10-31  2644  		sh = skb_header_pointer(skb, skb_transport_offset(skb), sizeof(_sctph), &_sctph);
3139583951cf29 Ricardo Robaina    2025-10-31  2645  		if (!sh)
3139583951cf29 Ricardo Robaina    2025-10-31  2646  			return false;
3139583951cf29 Ricardo Robaina    2025-10-31  2647  
3139583951cf29 Ricardo Robaina    2025-10-31  2648  		audit_log_format(ab, " saddr=%pI6c daddr=%pI6c proto=%hhu sport=%hu dport=%hu",
3139583951cf29 Ricardo Robaina    2025-10-31  2649  				 &ih->saddr, &ih->daddr, nexthdr,
3139583951cf29 Ricardo Robaina    2025-10-31  2650  				 ntohs(sh->source), ntohs(sh->dest));
3139583951cf29 Ricardo Robaina    2025-10-31  2651  		break;
3139583951cf29 Ricardo Robaina    2025-10-31  2652  	default:
3280a1e8d8a110 Ricardo Robaina    2025-10-31  2653  		audit_log_format(ab, " saddr=%pI6c daddr=%pI6c proto=%hhu",
3280a1e8d8a110 Ricardo Robaina    2025-10-31  2654  				 &ih->saddr, &ih->daddr, nexthdr);
3139583951cf29 Ricardo Robaina    2025-10-31  2655  	}
3280a1e8d8a110 Ricardo Robaina    2025-10-31  2656  
3280a1e8d8a110 Ricardo Robaina    2025-10-31  2657  	return true;
3280a1e8d8a110 Ricardo Robaina    2025-10-31  2658  }
3280a1e8d8a110 Ricardo Robaina    2025-10-31  2659  EXPORT_SYMBOL(audit_log_packet_ip6);
3280a1e8d8a110 Ricardo Robaina    2025-10-31  2660  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

             reply	other threads:[~2025-11-02  1:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-02  1:25 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-10-31 13:59 [PATCH v4 0/2] audit: improve NETFILTER_PKT records Ricardo Robaina
2025-10-31 13:59 ` [PATCH v4 2/2] audit: include source and destination ports to NETFILTER_PKT Ricardo Robaina
2025-11-01  4:03   ` kernel test robot
2025-11-03 11:05     ` Ricardo Robaina

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=202511020905.3A5Sbhb2-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=error27@gmail.com \
    --cc=oe-kbuild@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.