Re: [PATCH 2/2] usbip: Implement SG support to vhci

From: kbuild test robot
Date: Sat Jun 22 2019 - 06:41:31 EST


Hi Suwan,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on usb/usb-testing]
[also build test WARNING on v5.2-rc5 next-20190621]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Suwan-Kim/usbip-Skip-DMA-mapping-and-unmapping-for-urb-at-vhci/20190622-130016
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-rc1-7-g2b96cd8-dirty
make ARCH=x86_64 allmodconfig
make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>


sparse warnings: (new ones prefixed by >>)

drivers/usb/usbip/usbip_common.c:419:33: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] command @@ got restrunsigned int [usertype] command @@
drivers/usb/usbip/usbip_common.c:419:33: sparse: expected unsigned int [usertype] command
drivers/usb/usbip/usbip_common.c:419:33: sparse: got restricted __be32 [usertype]
drivers/usb/usbip/usbip_common.c:420:33: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] seqnum @@ got restrunsigned int [usertype] seqnum @@
drivers/usb/usbip/usbip_common.c:420:33: sparse: expected unsigned int [usertype] seqnum
drivers/usb/usbip/usbip_common.c:420:33: sparse: got restricted __be32 [usertype]
drivers/usb/usbip/usbip_common.c:421:33: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] devid @@ got restrunsigned int [usertype] devid @@
drivers/usb/usbip/usbip_common.c:421:33: sparse: expected unsigned int [usertype] devid
drivers/usb/usbip/usbip_common.c:421:33: sparse: got restricted __be32 [usertype]
drivers/usb/usbip/usbip_common.c:422:33: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] direction @@ got restrunsigned int [usertype] direction @@
drivers/usb/usbip/usbip_common.c:422:33: sparse: expected unsigned int [usertype] direction
drivers/usb/usbip/usbip_common.c:422:33: sparse: got restricted __be32 [usertype]
drivers/usb/usbip/usbip_common.c:423:33: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] ep @@ got restrunsigned int [usertype] ep @@
drivers/usb/usbip/usbip_common.c:423:33: sparse: expected unsigned int [usertype] ep
drivers/usb/usbip/usbip_common.c:423:33: sparse: got restricted __be32 [usertype]
drivers/usb/usbip/usbip_common.c:425:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:425:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:425:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:425:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:425:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:425:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:426:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:426:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:426:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:426:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:426:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:426:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:427:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:427:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:427:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:427:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:427:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:427:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:428:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:428:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:428:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:428:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:428:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:428:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:429:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:429:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:429:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:429:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:429:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:429:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:437:37: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] transfer_flags @@ got restrunsigned int [usertype] transfer_flags @@
drivers/usb/usbip/usbip_common.c:437:37: sparse: expected unsigned int [usertype] transfer_flags
drivers/usb/usbip/usbip_common.c:437:37: sparse: got restricted __be32 [usertype]
>> drivers/usb/usbip/usbip_common.c:438:30: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] num_sgs @@ got restrunsigned int [usertype] num_sgs @@
>> drivers/usb/usbip/usbip_common.c:438:30: sparse: expected unsigned int [usertype] num_sgs
drivers/usb/usbip/usbip_common.c:438:30: sparse: got restricted __be32 [usertype]
drivers/usb/usbip/usbip_common.c:445:39: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:445:39: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:445:39: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:445:39: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:445:39: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:445:39: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:446:32: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:446:32: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:446:32: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:446:32: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:446:32: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:446:32: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:477:29: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] seqnum @@ got restrunsigned int [usertype] seqnum @@
drivers/usb/usbip/usbip_common.c:477:29: sparse: expected unsigned int [usertype] seqnum
drivers/usb/usbip/usbip_common.c:477:29: sparse: got restricted __be32 [usertype]
drivers/usb/usbip/usbip_common.c:479:31: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:479:31: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:479:31: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:479:31: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:479:31: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:479:31: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:529:33: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] offset @@ got restrunsigned int [usertype] offset @@
drivers/usb/usbip/usbip_common.c:529:33: sparse: expected unsigned int [usertype] offset
drivers/usb/usbip/usbip_common.c:529:33: sparse: got restricted __be32 [usertype]
drivers/usb/usbip/usbip_common.c:530:33: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] length @@ got restrunsigned int [usertype] length @@
drivers/usb/usbip/usbip_common.c:530:33: sparse: expected unsigned int [usertype] length
drivers/usb/usbip/usbip_common.c:530:33: sparse: got restricted __be32 [usertype]
drivers/usb/usbip/usbip_common.c:531:33: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] status @@ got restrunsigned int [usertype] status @@
drivers/usb/usbip/usbip_common.c:531:33: sparse: expected unsigned int [usertype] status
drivers/usb/usbip/usbip_common.c:531:33: sparse: got restricted __be32 [usertype]
drivers/usb/usbip/usbip_common.c:532:36: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] actual_length @@ got restrunsigned int [usertype] actual_length @@
drivers/usb/usbip/usbip_common.c:532:36: sparse: expected unsigned int [usertype] actual_length
drivers/usb/usbip/usbip_common.c:532:36: sparse: got restricted __be32 [usertype]
drivers/usb/usbip/usbip_common.c:534:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:534:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:534:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:534:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:534:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:534:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:535:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:535:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:535:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:535:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:535:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:535:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:536:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:536:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:536:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:536:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:536:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:536:35: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:537:38: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:537:38: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:537:38: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:537:38: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:537:38: sparse: sparse: cast to restricted __be32
drivers/usb/usbip/usbip_common.c:537:38: sparse: sparse: cast to restricted __be32

vim +438 drivers/usb/usbip/usbip_common.c

415
416 static void correct_endian_basic(struct usbip_header_basic *base, int send)
417 {
418 if (send) {
419 base->command = cpu_to_be32(base->command);
420 base->seqnum = cpu_to_be32(base->seqnum);
421 base->devid = cpu_to_be32(base->devid);
422 base->direction = cpu_to_be32(base->direction);
423 base->ep = cpu_to_be32(base->ep);
424 } else {
425 base->command = be32_to_cpu(base->command);
426 base->seqnum = be32_to_cpu(base->seqnum);
427 base->devid = be32_to_cpu(base->devid);
428 base->direction = be32_to_cpu(base->direction);
> 429 base->ep = be32_to_cpu(base->ep);
430 }
431 }
432
433 static void correct_endian_cmd_submit(struct usbip_header_cmd_submit *pdu,
434 int send)
435 {
436 if (send) {
437 pdu->transfer_flags = cpu_to_be32(pdu->transfer_flags);
> 438 pdu->num_sgs = cpu_to_be32(pdu->num_sgs);
439
440 cpu_to_be32s(&pdu->transfer_buffer_length);
441 cpu_to_be32s(&pdu->start_frame);
442 cpu_to_be32s(&pdu->number_of_packets);
443 cpu_to_be32s(&pdu->interval);
444 } else {
445 pdu->transfer_flags = be32_to_cpu(pdu->transfer_flags);
446 pdu->num_sgs = be32_to_cpu(pdu->num_sgs);
447
448 be32_to_cpus(&pdu->transfer_buffer_length);
449 be32_to_cpus(&pdu->start_frame);
450 be32_to_cpus(&pdu->number_of_packets);
451 be32_to_cpus(&pdu->interval);
452 }
453 }
454

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation