netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Hongbo Li <lihongbo22@huawei.com>,
	johannes@sipsolutions.net, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	allison.henderson@oracle.com, dsahern@kernel.org,
	pshelar@ovn.org
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
	rds-devel@oss.oracle.com, dccp@vger.kernel.org,
	dev@openvswitch.org, linux-afs@lists.infradead.org,
	lihongbo22@huawei.com
Subject: Re: [PATCH net-next 4/8] net/core: Use min()/max() to simplify the code
Date: Wed, 28 Aug 2024 15:36:28 +0800	[thread overview]
Message-ID: <202408281516.thVNxpEo-lkp@intel.com> (raw)
In-Reply-To: <20240824074033.2134514-5-lihongbo22@huawei.com>

Hi Hongbo,

kernel test robot noticed the following build errors:

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

url:    https://github.com/intel-lab-lkp/linux/commits/Hongbo-Li/net-mac80211-use-max-to-simplify-the-code/20240826-154029
base:   net-next/main
patch link:    https://lore.kernel.org/r/20240824074033.2134514-5-lihongbo22%40huawei.com
patch subject: [PATCH net-next 4/8] net/core: Use min()/max() to simplify the code
config: hexagon-allmodconfig (https://download.01.org/0day-ci/archive/20240828/202408281516.thVNxpEo-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 08e5a1de8227512d4774a534b91cb2353cef6284)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240828/202408281516.thVNxpEo-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/202408281516.thVNxpEo-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from net/core/pktgen.c:126:
   In file included from include/linux/ptrace.h:10:
   In file included from include/linux/pid_namespace.h:7:
   In file included from include/linux/mm.h:2228:
   include/linux/vmstat.h:517:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     517 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
   In file included from net/core/pktgen.c:129:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:14:
   In file included from arch/hexagon/include/asm/io.h:328:
   include/asm-generic/io.h:548:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     548 |         val = __raw_readb(PCI_IOBASE + addr);
         |                           ~~~~~~~~~~ ^
   include/asm-generic/io.h:561:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     561 |         val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
         |                                                         ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
      37 | #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
         |                                                   ^
   In file included from net/core/pktgen.c:129:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:14:
   In file included from arch/hexagon/include/asm/io.h:328:
   include/asm-generic/io.h:574:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     574 |         val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
         |                                                         ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
      35 | #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
         |                                                   ^
   In file included from net/core/pktgen.c:129:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:14:
   In file included from arch/hexagon/include/asm/io.h:328:
   include/asm-generic/io.h:585:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     585 |         __raw_writeb(value, PCI_IOBASE + addr);
         |                             ~~~~~~~~~~ ^
   include/asm-generic/io.h:595:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     595 |         __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
         |                                                       ~~~~~~~~~~ ^
   include/asm-generic/io.h:605:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     605 |         __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
         |                                                       ~~~~~~~~~~ ^
>> net/core/pktgen.c:2796:14: error: call to '__compiletime_assert_743' declared with 'error' attribute: min(datalen/frags, (1UL << 12)) signedness error
    2796 |                 frag_len = min(datalen/frags, PAGE_SIZE);
         |                            ^
   include/linux/minmax.h:129:19: note: expanded from macro 'min'
     129 | #define min(x, y)       __careful_cmp(min, x, y)
         |                         ^
   include/linux/minmax.h:105:2: note: expanded from macro '__careful_cmp'
     105 |         __careful_cmp_once(op, x, y, __UNIQUE_ID(x_), __UNIQUE_ID(y_))
         |         ^
   include/linux/minmax.h:100:2: note: expanded from macro '__careful_cmp_once'
     100 |         BUILD_BUG_ON_MSG(!__types_ok(x,y,ux,uy),        \
         |         ^
   note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:498:2: note: expanded from macro '_compiletime_assert'
     498 |         __compiletime_assert(condition, msg, prefix, suffix)
         |         ^
   include/linux/compiler_types.h:491:4: note: expanded from macro '__compiletime_assert'
     491 |                         prefix ## suffix();                             \
         |                         ^
   <scratch space>:6:1: note: expanded from here
       6 | __compiletime_assert_743
         | ^
   7 warnings and 1 error generated.


vim +2796 net/core/pktgen.c

  2769	
  2770	static void pktgen_finalize_skb(struct pktgen_dev *pkt_dev, struct sk_buff *skb,
  2771					int datalen)
  2772	{
  2773		struct timespec64 timestamp;
  2774		struct pktgen_hdr *pgh;
  2775	
  2776		pgh = skb_put(skb, sizeof(*pgh));
  2777		datalen -= sizeof(*pgh);
  2778	
  2779		if (pkt_dev->nfrags <= 0) {
  2780			skb_put_zero(skb, datalen);
  2781		} else {
  2782			int frags = pkt_dev->nfrags;
  2783			int i, len;
  2784			int frag_len;
  2785	
  2786	
  2787			if (frags > MAX_SKB_FRAGS)
  2788				frags = MAX_SKB_FRAGS;
  2789			len = datalen - frags * PAGE_SIZE;
  2790			if (len > 0) {
  2791				skb_put_zero(skb, len);
  2792				datalen = frags * PAGE_SIZE;
  2793			}
  2794	
  2795			i = 0;
> 2796			frag_len = min(datalen/frags, PAGE_SIZE);
  2797			while (datalen > 0) {
  2798				if (unlikely(!pkt_dev->page)) {
  2799					int node = numa_node_id();
  2800	
  2801					if (pkt_dev->node >= 0 && (pkt_dev->flags & F_NODE))
  2802						node = pkt_dev->node;
  2803					pkt_dev->page = alloc_pages_node(node, GFP_KERNEL | __GFP_ZERO, 0);
  2804					if (!pkt_dev->page)
  2805						break;
  2806				}
  2807				get_page(pkt_dev->page);
  2808	
  2809				/*last fragment, fill rest of data*/
  2810				if (i == (frags - 1))
  2811					skb_frag_fill_page_desc(&skb_shinfo(skb)->frags[i],
  2812								pkt_dev->page, 0,
  2813								min(datalen, PAGE_SIZE));
  2814				else
  2815					skb_frag_fill_page_desc(&skb_shinfo(skb)->frags[i],
  2816								pkt_dev->page, 0, frag_len);
  2817	
  2818				datalen -= skb_frag_size(&skb_shinfo(skb)->frags[i]);
  2819				skb->len += skb_frag_size(&skb_shinfo(skb)->frags[i]);
  2820				skb->data_len += skb_frag_size(&skb_shinfo(skb)->frags[i]);
  2821				i++;
  2822				skb_shinfo(skb)->nr_frags = i;
  2823			}
  2824		}
  2825	
  2826		/* Stamp the time, and sequence number,
  2827		 * convert them to network byte order
  2828		 */
  2829		pgh->pgh_magic = htonl(PKTGEN_MAGIC);
  2830		pgh->seq_num = htonl(pkt_dev->seq_num);
  2831	
  2832		if (pkt_dev->flags & F_NO_TIMESTAMP) {
  2833			pgh->tv_sec = 0;
  2834			pgh->tv_usec = 0;
  2835		} else {
  2836			/*
  2837			 * pgh->tv_sec wraps in y2106 when interpreted as unsigned
  2838			 * as done by wireshark, or y2038 when interpreted as signed.
  2839			 * This is probably harmless, but if anyone wants to improve
  2840			 * it, we could introduce a variant that puts 64-bit nanoseconds
  2841			 * into the respective header bytes.
  2842			 * This would also be slightly faster to read.
  2843			 */
  2844			ktime_get_real_ts64(&timestamp);
  2845			pgh->tv_sec = htonl(timestamp.tv_sec);
  2846			pgh->tv_usec = htonl(timestamp.tv_nsec / NSEC_PER_USEC);
  2847		}
  2848	}
  2849	

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

  reply	other threads:[~2024-08-28  7:36 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-24  7:40 [PATCH net-next 0/8] Use max/min to simplify the code Hongbo Li
2024-08-24  7:40 ` [PATCH net-next 1/8] net/mac80211: use max " Hongbo Li
2024-08-26 19:02   ` Kalle Valo
2024-08-24  7:40 ` [PATCH net-next 2/8] net/rds: Use max() " Hongbo Li
2024-08-27  5:28   ` Allison Henderson
2024-08-28 13:53   ` Simon Horman
2024-08-24  7:40 ` [PATCH net-next 3/8] net/ipv4: Use min() " Hongbo Li
2024-08-24  7:40 ` [PATCH net-next 4/8] net/core: Use min()/max() " Hongbo Li
2024-08-28  7:36   ` kernel test robot [this message]
2024-08-28  8:17   ` kernel test robot
2024-08-28 13:59   ` Simon Horman
2024-08-24  7:40 ` [PATCH net-next 5/8] net/dccp: " Hongbo Li
2024-08-28 14:04   ` Simon Horman
2024-08-24  7:40 ` [PATCH net-next 6/8] net/openvswitch: Use max() " Hongbo Li
2024-08-26  6:37   ` Eelco Chaudron
2024-08-26 17:58   ` [ovs-dev] " Aaron Conole
2024-08-28 14:10   ` Simon Horman
2024-08-24  7:40 ` [PATCH net-next 7/8] net/rxrpc: Use min() " Hongbo Li
2024-08-24 12:06   ` David Howells
2024-08-26  1:41     ` Hongbo Li
2024-08-26  2:50     ` Hongbo Li
2024-08-27 17:58       ` Simon Horman
2024-08-28  8:17       ` David Howells
2024-08-29 16:46         ` David Laight
2024-08-24  7:40 ` [PATCH net-next 8/8] net/ceph: " Hongbo Li
2024-08-28 14:11   ` Simon Horman
2024-08-26 21:44 ` [PATCH net-next 0/8] Use max/min " Jakub Kicinski
2024-08-27  2:57   ` Hongbo Li
2024-08-27  4:45     ` Kalle Valo
2024-08-27 14:03       ` Jakub Kicinski
2024-08-27 14:31         ` Kalle Valo
2024-08-30  8:40         ` David Laight

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=202408281516.thVNxpEo-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=allison.henderson@oracle.com \
    --cc=davem@davemloft.net \
    --cc=dccp@vger.kernel.org \
    --cc=dev@openvswitch.org \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=johannes@sipsolutions.net \
    --cc=kuba@kernel.org \
    --cc=lihongbo22@huawei.com \
    --cc=linux-afs@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=netdev@vger.kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=pabeni@redhat.com \
    --cc=pshelar@ovn.org \
    --cc=rds-devel@oss.oracle.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).