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,
	"Michael S. Tsirkin" <mst@redhat.com>
Subject: drivers/virtio/virtio_ring.c:3125 virtqueue_dma_map_single_attrs() warn: unsigned '_x' is never less than zero.
Date: Sun, 16 Feb 2025 22:39:48 +0800	[thread overview]
Message-ID: <202502162211.cxOr2wqP-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   ad1b832bf1cf2df9304f8eb72943111625c7e5a7
commit: 840b2d39a2dc1b96deb3f5c7fef76c9b24f08f51 virtio_ring: fix KMSAN error for premapped mode
date:   8 months ago
config: riscv-randconfig-r073-20250213 (https://download.01.org/0day-ci/archive/20250216/202502162211.cxOr2wqP-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/202502162211.cxOr2wqP-lkp@intel.com/

New smatch warnings:
drivers/virtio/virtio_ring.c:3125 virtqueue_dma_map_single_attrs() warn: unsigned '_x' is never less than zero.

Old smatch warnings:
include/asm-generic/io.h:1005 virt_to_phys() warn: unsigned '_x' is never less than zero.
include/linux/dma-mapping.h:388 dma_map_single_attrs() warn: unsigned '_x' is never less than zero.
drivers/virtio/virtio_ring.c:1516 virtqueue_add_packed() error: uninitialized symbol 'prev'.
drivers/virtio/virtio_ring.c:1524 virtqueue_add_packed() error: uninitialized symbol 'head_flags'.
drivers/virtio/virtio_ring.c:645 virtqueue_add_split() error: uninitialized symbol 'prev'.

vim +/_x +3125 drivers/virtio/virtio_ring.c

  3103	
  3104	/**
  3105	 * virtqueue_dma_map_single_attrs - map DMA for _vq
  3106	 * @_vq: the struct virtqueue we're talking about.
  3107	 * @ptr: the pointer of the buffer to do dma
  3108	 * @size: the size of the buffer to do dma
  3109	 * @dir: DMA direction
  3110	 * @attrs: DMA Attrs
  3111	 *
  3112	 * The caller calls this to do dma mapping in advance. The DMA address can be
  3113	 * passed to this _vq when it is in pre-mapped mode.
  3114	 *
  3115	 * return DMA address. Caller should check that by virtqueue_dma_mapping_error().
  3116	 */
  3117	dma_addr_t virtqueue_dma_map_single_attrs(struct virtqueue *_vq, void *ptr,
  3118						  size_t size,
  3119						  enum dma_data_direction dir,
  3120						  unsigned long attrs)
  3121	{
  3122		struct vring_virtqueue *vq = to_vvq(_vq);
  3123	
  3124		if (!vq->use_dma_api) {
> 3125			kmsan_handle_dma(virt_to_page(ptr), offset_in_page(ptr), size, dir);
  3126			return (dma_addr_t)virt_to_phys(ptr);
  3127		}
  3128	
  3129		return dma_map_single_attrs(vring_dma_dev(vq), ptr, size, dir, attrs);
  3130	}
  3131	EXPORT_SYMBOL_GPL(virtqueue_dma_map_single_attrs);
  3132	

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

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

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=202502162211.cxOr2wqP-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --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®