[PATCHv2 1/4] block: bio-integrity: directly map user buffers
kernel test robot
lkp at intel.com
Mon Oct 30 19:46:25 PDT 2023
Hi Keith,
kernel test robot noticed the following build errors:
[auto build test ERROR on axboe-block/for-next]
[also build test ERROR on linus/master v6.6 next-20231030]
[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/Keith-Busch/block-bio-integrity-directly-map-user-buffers/20231028-022107
base: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-next
patch link: https://lore.kernel.org/r/20231027181929.2589937-2-kbusch%40meta.com
patch subject: [PATCHv2 1/4] block: bio-integrity: directly map user buffers
config: mips-allmodconfig (https://download.01.org/0day-ci/archive/20231031/202310311041.38ISTxlo-lkp@intel.com/config)
compiler: mips-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231031/202310311041.38ISTxlo-lkp@intel.com/reproduce)
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 at intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202310311041.38ISTxlo-lkp@intel.com/
All errors (new ones prefixed by >>):
block/bio-integrity.c: In function 'bio_integrity_map_user':
>> block/bio-integrity.c:294:72: error: passing argument 6 of 'iov_iter_extract_pages' from incompatible pointer type [-Werror=incompatible-pointer-types]
294 | bytes = iov_iter_extract_pages(&iter, &pages, len, nr_vecs, 0, &offs);
| ^~~~~
| |
| long unsigned int *
In file included from include/linux/bio.h:11,
from include/linux/blkdev.h:17,
from include/linux/blk-mq.h:5,
from include/linux/blk-integrity.h:5,
from block/bio-integrity.c:9:
include/linux/uio.h:400:40: note: expected 'size_t *' {aka 'unsigned int *'} but argument is of type 'long unsigned int *'
400 | size_t *offset0);
| ~~~~~~~~^~~~~~~
cc1: some warnings being treated as errors
vim +/iov_iter_extract_pages +294 block/bio-integrity.c
257
258 int bio_integrity_map_user(struct bio *bio, void __user *ubuf, unsigned int len,
259 u32 seed)
260 {
261 struct request_queue *q = bdev_get_queue(bio->bi_bdev);
262 unsigned long offs, align = q->dma_pad_mask | queue_dma_alignment(q);
263 int ret, direction, nr_vecs, i, j, folios = 0;
264 struct bio_vec stack_vec[UIO_FASTIOV];
265 struct bio_vec bv, *bvec = stack_vec;
266 struct page *stack_pages[UIO_FASTIOV];
267 struct page **pages = stack_pages;
268 struct bio_integrity_payload *bip;
269 struct iov_iter iter;
270 struct bvec_iter bi;
271 u32 bytes;
272
273 if (bio_integrity(bio))
274 return -EINVAL;
275 if (len >> SECTOR_SHIFT > queue_max_hw_sectors(q))
276 return -E2BIG;
277
278 if (bio_data_dir(bio) == READ)
279 direction = ITER_DEST;
280 else
281 direction = ITER_SOURCE;
282
283 iov_iter_ubuf(&iter, direction, ubuf, len);
284 nr_vecs = iov_iter_npages(&iter, BIO_MAX_VECS + 1);
285 if (nr_vecs > BIO_MAX_VECS)
286 return -E2BIG;
287 if (nr_vecs > UIO_FASTIOV) {
288 bvec = kcalloc(sizeof(*bvec), nr_vecs, GFP_KERNEL);
289 if (!bvec)
290 return -ENOMEM;
291 pages = NULL;
292 }
293
> 294 bytes = iov_iter_extract_pages(&iter, &pages, len, nr_vecs, 0, &offs);
295 if (unlikely(bytes < 0)) {
296 ret = bytes;
297 goto free_bvec;
298 }
299
300 for (i = 0; i < nr_vecs; i = j) {
301 size_t size = min_t(size_t, bytes, PAGE_SIZE - offs);
302 struct folio *folio = page_folio(pages[i]);
303
304 bytes -= size;
305 for (j = i + 1; j < nr_vecs; j++) {
306 size_t next = min_t(size_t, PAGE_SIZE, bytes);
307
308 if (page_folio(pages[j]) != folio ||
309 pages[j] != pages[j - 1] + 1)
310 break;
311 unpin_user_page(pages[j]);
312 size += next;
313 bytes -= next;
314 }
315
316 bvec_set_page(&bvec[folios], pages[i], size, offs);
317 offs = 0;
318 folios++;
319 }
320
321 if (pages != stack_pages)
322 kvfree(pages);
323
324 if (folios > queue_max_integrity_segments(q) ||
325 !iov_iter_is_aligned(&iter, align, align)) {
326 ret = bio_integrity_copy_user(bio, bvec, folios, len,
327 direction, seed);
328 if (ret)
329 goto release_pages;
330 return 0;
331 }
332
333 bip = bio_integrity_alloc(bio, GFP_KERNEL, folios);
334 if (IS_ERR(bip)) {
335 ret = PTR_ERR(bip);
336 goto release_pages;
337 }
338
339 memcpy(bip->bip_vec, bvec, folios * sizeof(*bvec));
340 if (bvec != stack_vec)
341 kfree(bvec);
342
343 bip->bip_flags |= BIP_INTEGRITY_USER;
344 bip->copy_vec = NULL;
345 return 0;
346
347 release_pages:
348 bi.bi_size = len;
349 for_each_bvec(bv, bvec, bi, bi)
350 unpin_user_page(bv.bv_page);
351 free_bvec:
352 if (bvec != stack_vec)
353 kfree(bvec);
354 return ret;
355 }
356 EXPORT_SYMBOL_GPL(bio_integrity_map_user);
357
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
More information about the Linux-nvme
mailing list