mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
	Jakub Kicinski <kuba@kernel.org>
Subject: drivers/net/virtio_net.c:1227 xsk_append_merge_buffer() warn: unsigned '_x' is never less than zero.
Date: Sun, 16 Feb 2025 11:13:14 +0800	[thread overview]
Message-ID: <202502161158.KmluxANz-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   496659003dac5d08ea292c44fce9dfb36fa34691
commit: 99c861b44eb1fb9dfe8776854116a6a9064c19bb virtio_net: xsk: rx: support recv merge mode
date:   7 months ago
config: riscv-randconfig-r073-20250213 (https://download.01.org/0day-ci/archive/20250216/202502161158.KmluxANz-lkp@intel.com/config)
compiler: riscv32-linux-gcc (GCC) 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>
| Closes: https://lore.kernel.org/oe-kbuild-all/202502161158.KmluxANz-lkp@intel.com/

New smatch warnings:
drivers/net/virtio_net.c:1227 xsk_append_merge_buffer() warn: unsigned '_x' is never less than zero.

Old smatch warnings:
include/linux/mm.h:1311 virt_to_head_page() warn: unsigned '_x' is never less than zero.
include/linux/scatterlist.h:189 sg_set_buf() warn: unsigned '_x' is never less than zero.
drivers/net/virtio_net.c:1934 build_skb_from_xdp_buff() error: uninitialized symbol 'nr_frags'.
drivers/net/virtio_net.c:2016 virtnet_build_xdp_buff_mrg() error: uninitialized symbol 'shinfo'.
drivers/net/virtio_net.c:5096 virtnet_update_settings() error: uninitialized symbol 'virtio_cread_v'.
drivers/net/virtio_net.c:5804 virtnet_config_changed_work() error: uninitialized symbol 'virtio_cread_v'.
drivers/net/virtio_net.c:5808 virtnet_config_changed_work() error: uninitialized symbol 'v'.

vim +/_x +1227 drivers/net/virtio_net.c

  1184	
  1185	static int xsk_append_merge_buffer(struct virtnet_info *vi,
  1186					   struct receive_queue *rq,
  1187					   struct sk_buff *head_skb,
  1188					   u32 num_buf,
  1189					   struct virtio_net_hdr_mrg_rxbuf *hdr,
  1190					   struct virtnet_rq_stats *stats)
  1191	{
  1192		struct sk_buff *curr_skb;
  1193		struct xdp_buff *xdp;
  1194		u32 len, truesize;
  1195		struct page *page;
  1196		void *buf;
  1197	
  1198		curr_skb = head_skb;
  1199	
  1200		while (--num_buf) {
  1201			buf = virtqueue_get_buf(rq->vq, &len);
  1202			if (unlikely(!buf)) {
  1203				pr_debug("%s: rx error: %d buffers out of %d missing\n",
  1204					 vi->dev->name, num_buf,
  1205					 virtio16_to_cpu(vi->vdev,
  1206							 hdr->num_buffers));
  1207				DEV_STATS_INC(vi->dev, rx_length_errors);
  1208				return -EINVAL;
  1209			}
  1210	
  1211			u64_stats_add(&stats->bytes, len);
  1212	
  1213			xdp = buf_to_xdp(vi, rq, buf, len);
  1214			if (!xdp)
  1215				goto err;
  1216	
  1217			buf = napi_alloc_frag(len);
  1218			if (!buf) {
  1219				xsk_buff_free(xdp);
  1220				goto err;
  1221			}
  1222	
  1223			memcpy(buf, xdp->data - vi->hdr_len, len);
  1224	
  1225			xsk_buff_free(xdp);
  1226	
> 1227			page = virt_to_page(buf);
  1228	
  1229			truesize = len;
  1230	
  1231			curr_skb  = virtnet_skb_append_frag(head_skb, curr_skb, page,
  1232							    buf, len, truesize);
  1233			if (!curr_skb) {
  1234				put_page(page);
  1235				goto err;
  1236			}
  1237		}
  1238	
  1239		return 0;
  1240	
  1241	err:
  1242		xsk_drop_follow_bufs(vi->dev, rq, num_buf, stats);
  1243		return -EINVAL;
  1244	}
  1245	

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

             reply	other threads:[~2025-02-16  3:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-16  3:13 kernel test robot [this message]
2025-02-17  3:02 ` Xuan Zhuo

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=202502161158.KmluxANz-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=xuanzhuo@linux.alibaba.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

all inboxes | Powered by JetHome®