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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202103101125.s4HrMQyc-lkp@intel.com>
Date:   Wed, 10 Mar 2021 11:08:21 +0800
From:   kernel test robot <lkp@...el.com>
To:     Laurent Vivier <laurent@...ier.eu>, linux-kernel@...r.kernel.org
Cc:     kbuild-all@...ts.01.org, virtualization@...ts.linux-foundation.org,
        "Michael S. Tsirkin" <mst@...hat.com>,
        Jason Wang <jasowang@...hat.com>,
        Laurent Vivier <laurent@...ier.eu>
Subject: Re: [PATCH] virtio-mmio: read[wl]()/write[wl] are already
 little-endian

Hi Laurent,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linux/master]
[also build test WARNING on linus/master v5.12-rc2 next-20210309]
[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]

url:    https://github.com/0day-ci/linux/commits/Laurent-Vivier/virtio-mmio-read-wl-write-wl-are-already-little-endian/20210310-064527
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 144c79ef33536b4ecb4951e07dbc1f2b7fa99d32
config: x86_64-randconfig-s022-20210310 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-262-g5e674421-dirty
        # https://github.com/0day-ci/linux/commit/1fd3d4da486545f554eb33663c6afe068bbcbcf8
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Laurent-Vivier/virtio-mmio-read-wl-write-wl-are-already-little-endian/20210310-064527
        git checkout 1fd3d4da486545f554eb33663c6afe068bbcbcf8
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>


"sparse warnings: (new ones prefixed by >>)"
   drivers/virtio/virtio_mmio.c:171:19: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le16 [usertype] w @@     got unsigned short @@
   drivers/virtio/virtio_mmio.c:171:19: sparse:     expected restricted __le16 [usertype] w
   drivers/virtio/virtio_mmio.c:171:19: sparse:     got unsigned short
   drivers/virtio/virtio_mmio.c:175:19: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le32 [usertype] l @@     got unsigned int @@
   drivers/virtio/virtio_mmio.c:175:19: sparse:     expected restricted __le32 [usertype] l
   drivers/virtio/virtio_mmio.c:175:19: sparse:     got unsigned int
   drivers/virtio/virtio_mmio.c:179:19: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le32 [addressable] [usertype] l @@     got unsigned int @@
   drivers/virtio/virtio_mmio.c:179:19: sparse:     expected restricted __le32 [addressable] [usertype] l
   drivers/virtio/virtio_mmio.c:179:19: sparse:     got unsigned int
   drivers/virtio/virtio_mmio.c:181:19: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le32 [addressable] [usertype] l @@     got unsigned int @@
   drivers/virtio/virtio_mmio.c:181:19: sparse:     expected restricted __le32 [addressable] [usertype] l
   drivers/virtio/virtio_mmio.c:181:19: sparse:     got unsigned int
>> drivers/virtio/virtio_mmio.c:215:24: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected unsigned short val @@     got restricted __le16 [addressable] [usertype] w @@
   drivers/virtio/virtio_mmio.c:215:24: sparse:     expected unsigned short val
   drivers/virtio/virtio_mmio.c:215:24: sparse:     got restricted __le16 [addressable] [usertype] w
>> drivers/virtio/virtio_mmio.c:219:24: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected unsigned int val @@     got restricted __le32 [addressable] [usertype] l @@
   drivers/virtio/virtio_mmio.c:219:24: sparse:     expected unsigned int val
   drivers/virtio/virtio_mmio.c:219:24: sparse:     got restricted __le32 [addressable] [usertype] l
   drivers/virtio/virtio_mmio.c:223:24: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected unsigned int val @@     got restricted __le32 [addressable] [usertype] l @@
   drivers/virtio/virtio_mmio.c:223:24: sparse:     expected unsigned int val
   drivers/virtio/virtio_mmio.c:223:24: sparse:     got restricted __le32 [addressable] [usertype] l
   drivers/virtio/virtio_mmio.c:225:24: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected unsigned int val @@     got restricted __le32 [addressable] [usertype] l @@
   drivers/virtio/virtio_mmio.c:225:24: sparse:     expected unsigned int val
   drivers/virtio/virtio_mmio.c:225:24: sparse:     got restricted __le32 [addressable] [usertype] l

vim +215 drivers/virtio/virtio_mmio.c

   188	
   189	static void vm_set(struct virtio_device *vdev, unsigned offset,
   190			   const void *buf, unsigned len)
   191	{
   192		struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vdev);
   193		void __iomem *base = vm_dev->base + VIRTIO_MMIO_CONFIG;
   194		u8 b;
   195		__le16 w;
   196		__le32 l;
   197	
   198		if (vm_dev->version == 1) {
   199			const u8 *ptr = buf;
   200			int i;
   201	
   202			for (i = 0; i < len; i++)
   203				writeb(ptr[i], base + offset + i);
   204	
   205			return;
   206		}
   207	
   208		switch (len) {
   209		case 1:
   210			memcpy(&b, buf, sizeof b);
   211			writeb(b, base + offset);
   212			break;
   213		case 2:
   214			memcpy(&w, buf, sizeof w);
 > 215			writew(w, base + offset);
   216			break;
   217		case 4:
   218			memcpy(&l, buf, sizeof l);
 > 219			writel(l, base + offset);
   220			break;
   221		case 8:
   222			memcpy(&l, buf, sizeof l);
   223			writel(l, base + offset);
   224			memcpy(&l, buf + sizeof l, sizeof l);
   225			writel(l, base + offset + sizeof l);
   226			break;
   227		default:
   228			BUG();
   229		}
   230	}
   231	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Download attachment ".config.gz" of type "application/gzip" (34366 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ