lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202505081920.FOOj1Z0e-lkp@intel.com>
Date: Thu, 8 May 2025 20:00:06 +0800
From: kernel test robot <lkp@...el.com>
To: Jon Kohler <jon@...anix.com>, "Michael S. Tsirkin" <mst@...hat.com>,
	Jason Wang <jasowang@...hat.com>,
	Eugenio Pérez <eperezma@...hat.com>,
	Alexei Starovoitov <ast@...nel.org>,
	Daniel Borkmann <daniel@...earbox.net>,
	"David S. Miller" <davem@...emloft.net>,
	Jakub Kicinski <kuba@...nel.org>,
	Jesper Dangaard Brouer <hawk@...nel.org>,
	John Fastabend <john.fastabend@...il.com>, kvm@...r.kernel.org,
	virtualization@...ts.linux.dev, linux-kernel@...r.kernel.org,
	bpf@...r.kernel.org
Cc: llvm@...ts.linux.dev, oe-kbuild-all@...ts.linux.dev,
	netdev@...r.kernel.org, Jon Kohler <jon@...anix.com>
Subject: Re: [PATCH net-next] vhost/net: align variable names with XDP
 terminology

Hi Jon,

kernel test robot noticed the following build warnings:

[auto build test WARNING on net-next/main]

url:    https://github.com/intel-lab-lkp/linux/commits/Jon-Kohler/vhost-net-align-variable-names-with-XDP-terminology/20250507-233429
base:   net-next/main
patch link:    https://lore.kernel.org/r/20250507160206.3267692-1-jon%40nutanix.com
patch subject: [PATCH net-next] vhost/net: align variable names with XDP terminology
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20250508/202505081920.FOOj1Z0e-lkp@intel.com/config)
compiler: clang version 20.1.2 (https://github.com/llvm/llvm-project 58df0ef89dd64126512e4ee27b4ac3fd8ddf6247)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250508/202505081920.FOOj1Z0e-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@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202505081920.FOOj1Z0e-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/vhost/net.c:681:28: warning: operator '?:' has lower precedence than '+'; '+' will be evaluated first [-Wparentheses]
     680 |         headroom = SKB_DATA_ALIGN(VHOST_NET_RX_PAD + sock_hlen +
         |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     681 |                                   vhost_sock_xdp(sock) ? XDP_PACKET_HEADROOM : 0);
         |                                   ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/skbuff.h:256:33: note: expanded from macro 'SKB_DATA_ALIGN'
     256 | #define SKB_DATA_ALIGN(X)       ALIGN(X, SMP_CACHE_BYTES)
         |                                 ~~~~~~^~~~~~~~~~~~~~~~~~~
   include/vdso/align.h:8:38: note: expanded from macro 'ALIGN'
       8 | #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
         |                                 ~~~~~~~~~~~~~~~~^~~~~~~~
   include/uapi/linux/const.h:48:51: note: expanded from macro '__ALIGN_KERNEL'
      48 | #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
         |                                         ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/uapi/linux/const.h:49:41: note: expanded from macro '__ALIGN_KERNEL_MASK'
      49 | #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
         |                                            ^
   drivers/vhost/net.c:681:28: note: place parentheses around the '+' expression to silence this warning
     680 |         headroom = SKB_DATA_ALIGN(VHOST_NET_RX_PAD + sock_hlen +
         |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     681 |                                   vhost_sock_xdp(sock) ? XDP_PACKET_HEADROOM : 0);
         |                                   ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/skbuff.h:256:33: note: expanded from macro 'SKB_DATA_ALIGN'
     256 | #define SKB_DATA_ALIGN(X)       ALIGN(X, SMP_CACHE_BYTES)
         |                                 ~~~~~~^~~~~~~~~~~~~~~~~~~
   include/vdso/align.h:8:38: note: expanded from macro 'ALIGN'
       8 | #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
         |                                 ~~~~~~~~~~~~~~~~^~~~~~~~
   include/uapi/linux/const.h:48:51: note: expanded from macro '__ALIGN_KERNEL'
      48 | #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
         |                                         ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/uapi/linux/const.h:49:41: note: expanded from macro '__ALIGN_KERNEL_MASK'
      49 | #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
         |                                            ^
   drivers/vhost/net.c:681:28: note: place parentheses around the '?:' expression to evaluate it first
     680 |         headroom = SKB_DATA_ALIGN(VHOST_NET_RX_PAD + sock_hlen +
         |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     681 |                                   vhost_sock_xdp(sock) ? XDP_PACKET_HEADROOM : 0);
         |                                   ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/skbuff.h:256:33: note: expanded from macro 'SKB_DATA_ALIGN'
     256 | #define SKB_DATA_ALIGN(X)       ALIGN(X, SMP_CACHE_BYTES)
         |                                 ~~~~~~^~~~~~~~~~~~~~~~~~~
   include/vdso/align.h:8:38: note: expanded from macro 'ALIGN'
       8 | #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
         |                                 ~~~~~~~~~~~~~~~~^~~~~~~~
   include/uapi/linux/const.h:48:51: note: expanded from macro '__ALIGN_KERNEL'
      48 | #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
         |                                         ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/uapi/linux/const.h:49:41: note: expanded from macro '__ALIGN_KERNEL_MASK'
      49 | #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
         |                                            ^
>> drivers/vhost/net.c:681:28: warning: operator '?:' has lower precedence than '+'; '+' will be evaluated first [-Wparentheses]
     680 |         headroom = SKB_DATA_ALIGN(VHOST_NET_RX_PAD + sock_hlen +
         |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     681 |                                   vhost_sock_xdp(sock) ? XDP_PACKET_HEADROOM : 0);
         |                                   ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/skbuff.h:256:33: note: expanded from macro 'SKB_DATA_ALIGN'
     256 | #define SKB_DATA_ALIGN(X)       ALIGN(X, SMP_CACHE_BYTES)
         |                                 ~~~~~~^~~~~~~~~~~~~~~~~~~
   include/vdso/align.h:8:38: note: expanded from macro 'ALIGN'
       8 | #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
         |                                 ~~~~~~~~~~~~~~~~^~~~~~~~
   include/uapi/linux/const.h:48:66: note: expanded from macro '__ALIGN_KERNEL'
      48 | #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
         |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
   include/uapi/linux/const.h:49:47: note: expanded from macro '__ALIGN_KERNEL_MASK'
      49 | #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
         |                                                  ^~~~
   drivers/vhost/net.c:681:28: note: place parentheses around the '+' expression to silence this warning
     680 |         headroom = SKB_DATA_ALIGN(VHOST_NET_RX_PAD + sock_hlen +
         |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     681 |                                   vhost_sock_xdp(sock) ? XDP_PACKET_HEADROOM : 0);
         |                                   ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/skbuff.h:256:33: note: expanded from macro 'SKB_DATA_ALIGN'
     256 | #define SKB_DATA_ALIGN(X)       ALIGN(X, SMP_CACHE_BYTES)
         |                                 ~~~~~~^~~~~~~~~~~~~~~~~~~
   include/vdso/align.h:8:38: note: expanded from macro 'ALIGN'
       8 | #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
         |                                 ~~~~~~~~~~~~~~~~^~~~~~~~
   include/uapi/linux/const.h:48:66: note: expanded from macro '__ALIGN_KERNEL'
      48 | #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
         |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
   include/uapi/linux/const.h:49:47: note: expanded from macro '__ALIGN_KERNEL_MASK'
      49 | #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
         |                                                  ^~~~
   drivers/vhost/net.c:681:28: note: place parentheses around the '?:' expression to evaluate it first
     680 |         headroom = SKB_DATA_ALIGN(VHOST_NET_RX_PAD + sock_hlen +
         |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     681 |                                   vhost_sock_xdp(sock) ? XDP_PACKET_HEADROOM : 0);
         |                                   ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/skbuff.h:256:33: note: expanded from macro 'SKB_DATA_ALIGN'
     256 | #define SKB_DATA_ALIGN(X)       ALIGN(X, SMP_CACHE_BYTES)
         |                                 ~~~~~~^~~~~~~~~~~~~~~~~~~
   include/vdso/align.h:8:38: note: expanded from macro 'ALIGN'
       8 | #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
         |                                 ~~~~~~~~~~~~~~~~^~~~~~~~
   include/uapi/linux/const.h:48:66: note: expanded from macro '__ALIGN_KERNEL'
      48 | #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
         |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
   include/uapi/linux/const.h:49:47: note: expanded from macro '__ALIGN_KERNEL_MASK'
      49 | #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
         |                                                  ^~~~
>> drivers/vhost/net.c:681:28: warning: operator '?:' has lower precedence than '+'; '+' will be evaluated first [-Wparentheses]
     680 |         headroom = SKB_DATA_ALIGN(VHOST_NET_RX_PAD + sock_hlen +
         |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     681 |                                   vhost_sock_xdp(sock) ? XDP_PACKET_HEADROOM : 0);
         |                                   ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/skbuff.h:256:33: note: expanded from macro 'SKB_DATA_ALIGN'
     256 | #define SKB_DATA_ALIGN(X)       ALIGN(X, SMP_CACHE_BYTES)
         |                                 ~~~~~~^~~~~~~~~~~~~~~~~~~
   include/vdso/align.h:8:38: note: expanded from macro 'ALIGN'
       8 | #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
         |                                 ~~~~~~~~~~~~~~~~^~~~~~~~
   include/uapi/linux/const.h:48:66: note: expanded from macro '__ALIGN_KERNEL'
      48 | #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
         |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
   include/uapi/linux/const.h:49:58: note: expanded from macro '__ALIGN_KERNEL_MASK'
      49 | #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
         |                                                             ^~~~
   drivers/vhost/net.c:681:28: note: place parentheses around the '+' expression to silence this warning
     680 |         headroom = SKB_DATA_ALIGN(VHOST_NET_RX_PAD + sock_hlen +
         |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     681 |                                   vhost_sock_xdp(sock) ? XDP_PACKET_HEADROOM : 0);
         |                                   ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/skbuff.h:256:33: note: expanded from macro 'SKB_DATA_ALIGN'
     256 | #define SKB_DATA_ALIGN(X)       ALIGN(X, SMP_CACHE_BYTES)
         |                                 ~~~~~~^~~~~~~~~~~~~~~~~~~
   include/vdso/align.h:8:38: note: expanded from macro 'ALIGN'
       8 | #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
         |                                 ~~~~~~~~~~~~~~~~^~~~~~~~
   include/uapi/linux/const.h:48:66: note: expanded from macro '__ALIGN_KERNEL'
      48 | #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
         |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
   include/uapi/linux/const.h:49:58: note: expanded from macro '__ALIGN_KERNEL_MASK'
      49 | #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
         |                                                             ^~~~
   drivers/vhost/net.c:681:28: note: place parentheses around the '?:' expression to evaluate it first
     680 |         headroom = SKB_DATA_ALIGN(VHOST_NET_RX_PAD + sock_hlen +
         |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     681 |                                   vhost_sock_xdp(sock) ? XDP_PACKET_HEADROOM : 0);
         |                                   ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/skbuff.h:256:33: note: expanded from macro 'SKB_DATA_ALIGN'
     256 | #define SKB_DATA_ALIGN(X)       ALIGN(X, SMP_CACHE_BYTES)
         |                                 ~~~~~~^~~~~~~~~~~~~~~~~~~
   include/vdso/align.h:8:38: note: expanded from macro 'ALIGN'
       8 | #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
         |                                 ~~~~~~~~~~~~~~~~^~~~~~~~
   include/uapi/linux/const.h:48:66: note: expanded from macro '__ALIGN_KERNEL'
      48 | #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
         |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
   include/uapi/linux/const.h:49:58: note: expanded from macro '__ALIGN_KERNEL_MASK'
      49 | #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
         |                                                             ^~~~
   3 warnings generated.


vim +681 drivers/vhost/net.c

   661	
   662	static int vhost_net_build_xdp(struct vhost_net_virtqueue *nvq,
   663				       struct iov_iter *from)
   664	{
   665		struct vhost_virtqueue *vq = &nvq->vq;
   666		struct vhost_net *net = container_of(vq->dev, struct vhost_net,
   667						     dev);
   668		int copied, headroom, ret, sock_hlen = nvq->sock_hlen;
   669		struct xdp_buff *xdp = &nvq->xdp[nvq->batched_xdp];
   670		struct socket *sock = vhost_vq_get_backend(vq);
   671		size_t data_len = iov_iter_count(from);
   672		struct virtio_net_hdr *gso;
   673		struct tun_xdp_hdr *hdr;
   674		void *hard_start;
   675		u32 frame_sz;
   676	
   677		if (unlikely(data_len < sock_hlen))
   678			return -EFAULT;
   679	
   680		headroom = SKB_DATA_ALIGN(VHOST_NET_RX_PAD + sock_hlen +
 > 681					  vhost_sock_xdp(sock) ? XDP_PACKET_HEADROOM : 0);
   682	
   683		frame_sz = SKB_HEAD_ALIGN(headroom + data_len);
   684	
   685		if (frame_sz > PAGE_SIZE)
   686			return -ENOSPC;
   687	
   688		hard_start = page_frag_alloc_align(&net->pf_cache, frame_sz,
   689						   GFP_KERNEL, SMP_CACHE_BYTES);
   690		if (unlikely(!hard_start))
   691			return -ENOMEM;
   692	
   693		copied = copy_from_iter(hard_start + offsetof(struct tun_xdp_hdr, gso),
   694					sock_hlen, from);
   695		if (copied != sock_hlen) {
   696			ret = -EFAULT;
   697			goto err;
   698		}
   699	
   700		hdr = hard_start;
   701		gso = &hdr->gso;
   702	
   703		if (!sock_hlen)
   704			memset(hard_start, 0, headroom);
   705	
   706		if ((gso->flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) &&
   707		    vhost16_to_cpu(vq, gso->csum_start) +
   708		    vhost16_to_cpu(vq, gso->csum_offset) + 2 >
   709		    vhost16_to_cpu(vq, gso->hdr_len)) {
   710			gso->hdr_len = cpu_to_vhost16(vq,
   711				       vhost16_to_cpu(vq, gso->csum_start) +
   712				       vhost16_to_cpu(vq, gso->csum_offset) + 2);
   713	
   714			if (vhost16_to_cpu(vq, gso->hdr_len) > data_len) {
   715				ret = -EINVAL;
   716				goto err;
   717			}
   718		}
   719	
   720		data_len -= sock_hlen;
   721		copied = copy_from_iter(hard_start + headroom, data_len, from);
   722		if (copied != data_len) {
   723			ret = -EFAULT;
   724			goto err;
   725		}
   726	
   727		xdp_init_buff(xdp, frame_sz, NULL);
   728		xdp_prepare_buff(xdp, hard_start, headroom, data_len, true);
   729		hdr->buflen = frame_sz;
   730	
   731		++nvq->batched_xdp;
   732	
   733		return 0;
   734	
   735	err:
   736		page_frag_free(hard_start);
   737		return ret;
   738	}
   739	

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ