Re: [PATCH 5/6] virtio/vsock: add support for dgram
From: kernel test robot
Date: Tue Aug 16 2022 - 01:05:10 EST
Hi Bobby,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on mst-vhost/linux-next]
[also build test WARNING on linus/master v6.0-rc1 next-20220815]
[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/Bobby-Eshleman/virtio-vsock-introduce-dgrams-sk_buff-and-qdisc/20220816-015812
base: https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git linux-next
config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20220816/202208160405.cG02E3MZ-lkp@xxxxxxxxx/config)
compiler: m68k-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/cbb332da78c86ac574688831ed6f404d04d506db
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Bobby-Eshleman/virtio-vsock-introduce-dgrams-sk_buff-and-qdisc/20220816-015812
git checkout cbb332da78c86ac574688831ed6f404d04d506db
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k SHELL=/bin/bash net/vmw_vsock/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>
All warnings (new ones prefixed by >>):
net/vmw_vsock/virtio_transport_common.c: In function 'virtio_transport_dgram_do_dequeue':
>> net/vmw_vsock/virtio_transport_common.c:605:13: warning: variable 'free_space' set but not used [-Wunused-but-set-variable]
605 | u32 free_space;
| ^~~~~~~~~~
vim +/free_space +605 net/vmw_vsock/virtio_transport_common.c
597
598 static ssize_t
599 virtio_transport_dgram_do_dequeue(struct vsock_sock *vsk,
600 struct msghdr *msg, size_t len)
601 {
602 struct virtio_vsock_sock *vvs = vsk->trans;
603 struct sk_buff *skb;
604 size_t total = 0;
> 605 u32 free_space;
606 int err = -EFAULT;
607
608 spin_lock_bh(&vvs->rx_lock);
609 if (total < len && !skb_queue_empty_lockless(&vvs->rx_queue)) {
610 skb = __skb_dequeue(&vvs->rx_queue);
611
612 total = len;
613 if (total > skb->len - vsock_metadata(skb)->off)
614 total = skb->len - vsock_metadata(skb)->off;
615 else if (total < skb->len - vsock_metadata(skb)->off)
616 msg->msg_flags |= MSG_TRUNC;
617
618 /* sk_lock is held by caller so no one else can dequeue.
619 * Unlock rx_lock since memcpy_to_msg() may sleep.
620 */
621 spin_unlock_bh(&vvs->rx_lock);
622
623 err = memcpy_to_msg(msg, skb->data + vsock_metadata(skb)->off, total);
624 if (err)
625 return err;
626
627 spin_lock_bh(&vvs->rx_lock);
628
629 virtio_transport_dec_rx_pkt(vvs, skb);
630 consume_skb(skb);
631 }
632
633 free_space = vvs->buf_alloc - (vvs->fwd_cnt - vvs->last_fwd_cnt);
634
635 spin_unlock_bh(&vvs->rx_lock);
636
637 if (total > 0 && msg->msg_name) {
638 /* Provide the address of the sender. */
639 DECLARE_SOCKADDR(struct sockaddr_vm *, vm_addr, msg->msg_name);
640
641 vsock_addr_init(vm_addr, le64_to_cpu(vsock_hdr(skb)->src_cid),
642 le32_to_cpu(vsock_hdr(skb)->src_port));
643 msg->msg_namelen = sizeof(*vm_addr);
644 }
645 return total;
646 }
647
--
0-DAY CI Kernel Test Service
https://01.org/lkp