lkml.org 
[lkml]   [2022]   [May]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subject[jsarha:topic/cros-sof-v4.19 353/6555] drivers/block/virtio_blk.c:197:32: sparse: sparse: incorrect type in assignment (different base types)
tree:   https://github.com/jsarha/linux topic/cros-sof-v4.19
head: d7a3e91d8d16d1ef8653deec5a1fffc4de034a0c
commit: 9f34ca2c7bcf381efb6f3e1a876dedf95f9b68ed [353/6555] BACKPORT: FROMLIST: virtio_blk: add discard and write zeroes support
config: i386-randconfig-s002-20220502 (https://download.01.org/0day-ci/archive/20220503/202205030546.EHrD3oCf-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.2.0-20) 11.2.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://github.com/jsarha/linux/commit/9f34ca2c7bcf381efb6f3e1a876dedf95f9b68ed
git remote add jsarha https://github.com/jsarha/linux
git fetch --no-tags jsarha topic/cros-sof-v4.19
git checkout 9f34ca2c7bcf381efb6f3e1a876dedf95f9b68ed
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=i386 SHELL=/bin/bash drivers/block/ drivers/input/keyboard/

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


sparse warnings: (new ones prefixed by >>)
>> drivers/block/virtio_blk.c:197:32: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __virtio32 [usertype] flags @@ got restricted __le32 [usertype] @@
drivers/block/virtio_blk.c:197:32: sparse: expected restricted __virtio32 [usertype] flags
drivers/block/virtio_blk.c:197:32: sparse: got restricted __le32 [usertype]
>> drivers/block/virtio_blk.c:198:38: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __virtio32 [usertype] num_sectors @@ got restricted __le32 [usertype] @@
drivers/block/virtio_blk.c:198:38: sparse: expected restricted __virtio32 [usertype] num_sectors
drivers/block/virtio_blk.c:198:38: sparse: got restricted __le32 [usertype]
>> drivers/block/virtio_blk.c:199:33: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __virtio64 [usertype] sector @@ got restricted __le64 [usertype] @@
drivers/block/virtio_blk.c:199:33: sparse: expected restricted __virtio64 [usertype] sector
drivers/block/virtio_blk.c:199:33: sparse: got restricted __le64 [usertype]

vim +197 drivers/block/virtio_blk.c

175
176
177 static inline int virtblk_setup_discard_write_zeroes(struct request *req,
178 bool unmap)
179 {
180 unsigned short segments = blk_rq_nr_discard_segments(req);
181 unsigned short n = 0;
182 struct virtio_blk_discard_write_zeroes *range;
183 struct bio *bio;
184 u32 flags = 0;
185
186 if (unmap)
187 flags |= VIRTIO_BLK_WRITE_ZEROES_FLAG_UNMAP;
188
189 range = kmalloc_array(segments, sizeof(*range), GFP_ATOMIC);
190 if (!range)
191 return -ENOMEM;
192
193 __rq_for_each_bio(bio, req) {
194 u64 sector = bio->bi_iter.bi_sector;
195 u32 num_sectors = bio->bi_iter.bi_size >> 9;
196
> 197 range[n].flags = cpu_to_le32(flags);
> 198 range[n].num_sectors = cpu_to_le32(num_sectors);
> 199 range[n].sector = cpu_to_le64(sector);
200 n++;
201 }
202
203 req->special_vec.bv_page = virt_to_page(range);
204 req->special_vec.bv_offset = offset_in_page(range);
205 req->special_vec.bv_len = sizeof(*range) * segments;
206 req->rq_flags |= RQF_SPECIAL_PAYLOAD;
207
208 return 0;
209 }
210

--
0-DAY CI Kernel Test Service
https://01.org/lkp

\
 
 \ /
  Last update: 2022-05-02 23:11    [W:0.021 / U:0.196 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site