[mkp-scsi:for-next 80/148] block/bsg.c:378:21: sparse: sparse: incorrect type in initializer (different address spaces)
From: kernel test robot
Date: Fri Aug 06 2021 - 03:33:52 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
head: f5efd4fe78de871515444b660029074be17ec11f
commit: d52fe8f436a6d9850b5e528cb94a651563a77374 [80/148] scsi: bsg: Decouple from scsi_cmd_ioctl()
config: sh-randconfig-s032-20210728 (attached as .config)
compiler: sh4-linux-gcc (GCC) 10.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.3-348-gf0e6938b-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git/commit/?id=d52fe8f436a6d9850b5e528cb94a651563a77374
git remote add mkp-scsi https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git
git fetch --no-tags mkp-scsi for-next
git checkout d52fe8f436a6d9850b5e528cb94a651563a77374
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=sh
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
sparse warnings: (new ones prefixed by >>)
block/bsg.c:340:13: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected int const *__gu_addr @@ got int [noderef] __user *uarg @@
block/bsg.c:340:13: sparse: expected int const *__gu_addr
block/bsg.c:340:13: sparse: got int [noderef] __user *uarg
block/bsg.c:340:13: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user *ptr @@ got int const *__gu_addr @@
block/bsg.c:340:13: sparse: expected void const volatile [noderef] __user *ptr
block/bsg.c:340:13: sparse: got int const *__gu_addr
>> block/bsg.c:378:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected int const *__gu_addr @@ got int [noderef] __user *intp @@
block/bsg.c:378:21: sparse: expected int const *__gu_addr
block/bsg.c:378:21: sparse: got int [noderef] __user *intp
block/bsg.c:378:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user *ptr @@ got int const *__gu_addr @@
block/bsg.c:378:21: sparse: expected void const volatile [noderef] __user *ptr
block/bsg.c:378:21: sparse: got int const *__gu_addr
block/bsg.c:388:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected int const *__gu_addr @@ got int [noderef] __user *intp @@
block/bsg.c:388:21: sparse: expected int const *__gu_addr
block/bsg.c:388:21: sparse: got int [noderef] __user *intp
block/bsg.c:388:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user *ptr @@ got int const *__gu_addr @@
block/bsg.c:388:21: sparse: expected void const volatile [noderef] __user *ptr
block/bsg.c:388:21: sparse: got int const *__gu_addr
vim +378 block/bsg.c
335
336 static int bsg_set_command_q(struct bsg_device *bd, int __user *uarg)
337 {
338 int queue;
339
> 340 if (get_user(queue, uarg))
341 return -EFAULT;
342 if (queue < 1)
343 return -EINVAL;
344
345 spin_lock_irq(&bd->lock);
346 bd->max_queue = queue;
347 spin_unlock_irq(&bd->lock);
348 return 0;
349 }
350
351 static long bsg_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
352 {
353 struct bsg_device *bd = file->private_data;
354 struct request_queue *q = bd->queue;
355 void __user *uarg = (void __user *) arg;
356 int __user *intp = uarg;
357 int val;
358
359 switch (cmd) {
360 /*
361 * Our own ioctls
362 */
363 case SG_GET_COMMAND_Q:
364 return bsg_get_command_q(bd, uarg);
365 case SG_SET_COMMAND_Q:
366 return bsg_set_command_q(bd, uarg);
367
368 /*
369 * SCSI/sg ioctls
370 */
371 case SG_GET_VERSION_NUM:
372 return put_user(30527, intp);
373 case SCSI_IOCTL_GET_IDLUN:
374 return put_user(0, intp);
375 case SCSI_IOCTL_GET_BUS_NUMBER:
376 return put_user(0, intp);
377 case SG_SET_TIMEOUT:
> 378 if (get_user(val, intp))
379 return -EFAULT;
380 q->sg_timeout = clock_t_to_jiffies(val);
381 return 0;
382 case SG_GET_TIMEOUT:
383 return jiffies_to_clock_t(q->sg_timeout);
384 case SG_GET_RESERVED_SIZE:
385 return put_user(min(q->sg_reserved_size, queue_max_bytes(q)),
386 intp);
387 case SG_SET_RESERVED_SIZE:
388 if (get_user(val, intp))
389 return -EFAULT;
390 if (val < 0)
391 return -EINVAL;
392 q->sg_reserved_size =
393 min_t(unsigned int, val, queue_max_bytes(q));
394 return 0;
395 case SG_EMULATED_HOST:
396 return put_user(1, intp);
397 case SG_IO:
398 return bsg_sg_io(q, file->f_mode, uarg);
399 case SCSI_IOCTL_SEND_COMMAND:
400 pr_warn_ratelimited("%s: calling unsupported SCSI_IOCTL_SEND_COMMAND\n",
401 current->comm);
402 return -EINVAL;
403 default:
404 return -ENOTTY;
405 }
406 }
407
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip