lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202502162211.cxOr2wqP-lkp@intel.com>
Date: Sun, 16 Feb 2025 22:39:48 +0800
From: kernel test robot <lkp@...el.com>
To: Xuan Zhuo <xuanzhuo@...ux.alibaba.com>
Cc: oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
	"Michael S. Tsirkin" <mst@...hat.com>
Subject: drivers/virtio/virtio_ring.c:3125 virtqueue_dma_map_single_attrs()
 warn: unsigned '_x' is never less than zero.

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@...el.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ