* drivers/net/virtio_net.c:1227 xsk_append_merge_buffer() warn: unsigned '_x' is never less than zero.
@ 2025-02-16 3:13 kernel test robot
2025-02-17 3:02 ` Xuan Zhuo
0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2025-02-16 3:13 UTC (permalink / raw)
To: Xuan Zhuo; +Cc: oe-kbuild-all, linux-kernel, Jakub Kicinski
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: drivers/net/virtio_net.c:1227 xsk_append_merge_buffer() warn: unsigned '_x' is never less than zero.
2025-02-16 3:13 drivers/net/virtio_net.c:1227 xsk_append_merge_buffer() warn: unsigned '_x' is never less than zero kernel test robot
@ 2025-02-17 3:02 ` Xuan Zhuo
0 siblings, 0 replies; 2+ messages in thread
From: Xuan Zhuo @ 2025-02-17 3:02 UTC (permalink / raw)
To: kernel test robot; +Cc: oe-kbuild-all, linux-kernel, Jakub Kicinski
On Sun, 16 Feb 2025 11:13:14 +0800, kernel test robot <lkp@intel.com> wrote:
> 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.
This seems to be in the mm system.
Thanks.
>
> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-02-17 3:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-16 3:13 drivers/net/virtio_net.c:1227 xsk_append_merge_buffer() warn: unsigned '_x' is never less than zero kernel test robot
2025-02-17 3:02 ` Xuan Zhuo
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®