kernel/trace/blktrace.c:347:12: sparse: sparse: incorrect type in assignment (different address spaces)

From: kernel test robot
Date: Wed Jun 03 2020 - 07:37:40 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: d6f9469a03d832dcd17041ed67774ffb5f3e73b3
commit: c780e86dd48ef6467a1146cf7d0fe1e05a635039 blktrace: Protect q->blk_trace with RCU
date: 3 months ago
config: arc-randconfig-s031-20200603 (attached as .config)
compiler: arc-elf-gcc (GCC) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-244-g0ee050a8-dirty
git checkout c780e86dd48ef6467a1146cf7d0fe1e05a635039
# save the attached .config to linux build tree
make W=1 C=1 ARCH=arc CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

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


sparse warnings: (new ones prefixed by >>)

>> kernel/trace/blktrace.c:347:12: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct blk_trace *bt @@ got struct blk_trace [noderef] <asn:4> *[assigned] old_val @@
kernel/trace/blktrace.c:347:12: sparse: expected struct blk_trace *bt
>> kernel/trace/blktrace.c:347:12: sparse: got struct blk_trace [noderef] <asn:4> *[assigned] old_val
kernel/trace/blktrace.c:770:5: sparse: sparse: symbol 'blk_trace_bio_get_cgid' was not declared. Should it be static?
kernel/trace/blktrace.c:998:50: sparse: sparse: incorrect type in argument 7 (different base types) @@ expected int error @@ got restricted blk_status_t [usertype] bi_status @@
kernel/trace/blktrace.c:998:50: sparse: expected int error
kernel/trace/blktrace.c:998:50: sparse: got restricted blk_status_t [usertype] bi_status
kernel/trace/blktrace.c:1036:68: sparse: sparse: incorrect type in argument 7 (different base types) @@ expected int error @@ got restricted blk_status_t [usertype] bi_status @@
kernel/trace/blktrace.c:1036:68: sparse: expected int error
kernel/trace/blktrace.c:1036:68: sparse: got restricted blk_status_t [usertype] bi_status
kernel/trace/blktrace.c:1257:16: sparse: sparse: cast to restricted __be64
kernel/trace/blktrace.c:1257:16: sparse: sparse: cast to restricted __be64
kernel/trace/blktrace.c:1257:16: sparse: sparse: cast to restricted __be64
kernel/trace/blktrace.c:1257:16: sparse: sparse: cast to restricted __be64
kernel/trace/blktrace.c:1257:16: sparse: sparse: cast to restricted __be64
kernel/trace/blktrace.c:1257:16: sparse: sparse: cast to restricted __be64
kernel/trace/blktrace.c:1257:16: sparse: sparse: cast to restricted __be64
kernel/trace/blktrace.c:1257:16: sparse: sparse: cast to restricted __be64
kernel/trace/blktrace.c:1257:16: sparse: sparse: cast to restricted __be64
kernel/trace/blktrace.c:1257:16: sparse: sparse: cast to restricted __be64
kernel/trace/blktrace.c:1264:32: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned long long [usertype] sector_from @@ got restricted __be64 const [usertype] sector_from @@
kernel/trace/blktrace.c:1264:32: sparse: expected unsigned long long [usertype] sector_from
kernel/trace/blktrace.c:1264:32: sparse: got restricted __be64 const [usertype] sector_from
kernel/trace/blktrace.c:1266:24: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be32 [usertype] device_from @@ got unsigned int @@
kernel/trace/blktrace.c:1266:24: sparse: expected restricted __be32 [usertype] device_from
kernel/trace/blktrace.c:1266:24: sparse: got unsigned int
kernel/trace/blktrace.c:1267:24: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be32 [usertype] device_to @@ got unsigned int @@
kernel/trace/blktrace.c:1267:24: sparse: expected restricted __be32 [usertype] device_to
kernel/trace/blktrace.c:1267:24: sparse: got unsigned int
kernel/trace/blktrace.c:1268:26: sparse: sparse: cast to restricted __be64
kernel/trace/blktrace.c:1268:26: sparse: sparse: cast to restricted __be64
kernel/trace/blktrace.c:1268:26: sparse: sparse: cast to restricted __be64
kernel/trace/blktrace.c:1268:26: sparse: sparse: cast to restricted __be64
kernel/trace/blktrace.c:1268:26: sparse: sparse: cast to restricted __be64
kernel/trace/blktrace.c:1268:26: sparse: sparse: cast to restricted __be64
kernel/trace/blktrace.c:1268:26: sparse: sparse: cast to restricted __be64
kernel/trace/blktrace.c:1268:26: sparse: sparse: cast to restricted __be64
kernel/trace/blktrace.c:1268:26: sparse: sparse: cast to restricted __be64
kernel/trace/blktrace.c:1268:26: sparse: sparse: cast to restricted __be64
kernel/trace/blktrace.c:1268:24: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be64 [usertype] sector_from @@ got unsigned long long @@
kernel/trace/blktrace.c:1268:24: sparse: expected restricted __be64 [usertype] sector_from
kernel/trace/blktrace.c:1268:24: sparse: got unsigned long long
kernel/trace/blktrace.c:1415:26: sparse: sparse: restricted __be32 degrades to integer
kernel/trace/blktrace.c:1415:48: sparse: sparse: restricted __be32 degrades to integer
kernel/trace/blktrace.c:1416:27: sparse: sparse: cast from restricted __be64
kernel/trace/blktrace.c:1640:12: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct blk_trace *bt @@ got struct blk_trace [noderef] <asn:4> *[assigned] old_val @@
kernel/trace/blktrace.c:1640:12: sparse: expected struct blk_trace *bt
kernel/trace/blktrace.c:1640:12: sparse: got struct blk_trace [noderef] <asn:4> *[assigned] old_val

vim +347 kernel/trace/blktrace.c

2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 342
1f2cac107c591c kernel/trace/blktrace.c Jens Axboe 2017-11-05 343 static int __blk_trace_remove(struct request_queue *q)
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 344 {
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 345 struct blk_trace *bt;
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 346
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 @347 bt = xchg(&q->blk_trace, NULL);
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 348 if (!bt)
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 349 return -EINVAL;
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 350
5554720482a631 kernel/trace/blktrace.c Li Zefan 2009-03-25 351 if (bt->trace_state != Blktrace_running)
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 352 blk_trace_cleanup(bt);
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 353
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 354 return 0;
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 355 }
1f2cac107c591c kernel/trace/blktrace.c Jens Axboe 2017-11-05 356

:::::: The code at line 347 was first introduced by commit
:::::: 2056a782f8e7e65fd4bfd027506b4ce1c5e9ccd4 [PATCH] Block queue IO tracing support (blktrace) as of 2006-03-23

:::::: TO: Jens Axboe <axboe@xxxxxxx>
:::::: CC: Jens Axboe <axboe@xxxxxxx>

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

Attachment: .config.gz
Description: application/gzip