Re: [PATCH] md/raid10: fix: incompatible types in comparison expression (different address spaces).

From: kernel test robot
Date: Wed Dec 23 2020 - 20:09:20 EST


Hi YANG,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on song-md/md-next]
[also build test WARNING on v5.10 next-20201223]
[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]

url: https://github.com/0day-ci/linux/commits/YANG-LI/md-raid10-fix-incompatible-types-in-comparison-expression-different-address-spaces/20201222-160648
base: git://git.kernel.org/pub/scm/linux/kernel/git/song/md.git md-next
config: x86_64-randconfig-s021-20201222 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.3-184-g1b896707-dirty
# https://github.com/0day-ci/linux/commit/6efb13c7253fb18a4e7844bdb367008c3f13ec7b
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review YANG-LI/md-raid10-fix-incompatible-types-in-comparison-expression-different-address-spaces/20201222-160648
git checkout 6efb13c7253fb18a4e7844bdb367008c3f13ec7b
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64

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


"sparse warnings: (new ones prefixed by >>)"
>> drivers/md/raid10.c:5128:22: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct md_rdev *rdev @@ got struct md_rdev [noderef] __rcu *replacement @@
drivers/md/raid10.c:5128:22: sparse: expected struct md_rdev *rdev
drivers/md/raid10.c:5128:22: sparse: got struct md_rdev [noderef] __rcu *replacement
>> drivers/md/raid10.c:5131:22: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct md_rdev *rdev @@ got struct md_rdev [noderef] __rcu *rdev @@
drivers/md/raid10.c:5131:22: sparse: expected struct md_rdev *rdev
drivers/md/raid10.c:5131:22: sparse: got struct md_rdev [noderef] __rcu *rdev
drivers/md/raid10.c:442:22: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct md_rdev *rdev @@ got struct md_rdev [noderef] __rcu *replacement @@
drivers/md/raid10.c:442:22: sparse: expected struct md_rdev *rdev
drivers/md/raid10.c:442:22: sparse: got struct md_rdev [noderef] __rcu *replacement
drivers/md/raid10.c:446:22: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct md_rdev *rdev @@ got struct md_rdev [noderef] __rcu *rdev @@
drivers/md/raid10.c:446:22: sparse: expected struct md_rdev *rdev
drivers/md/raid10.c:446:22: sparse: got struct md_rdev [noderef] __rcu *rdev
drivers/md/raid10.c:1226:22: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct md_rdev *rdev @@ got struct md_rdev [noderef] __rcu *replacement @@
drivers/md/raid10.c:1226:22: sparse: expected struct md_rdev *rdev
drivers/md/raid10.c:1226:22: sparse: got struct md_rdev [noderef] __rcu *replacement
drivers/md/raid10.c:1230:30: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct md_rdev *rdev @@ got struct md_rdev [noderef] __rcu *rdev @@
drivers/md/raid10.c:1230:30: sparse: expected struct md_rdev *rdev
drivers/md/raid10.c:1230:30: sparse: got struct md_rdev [noderef] __rcu *rdev
drivers/md/raid10.c:1233:22: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct md_rdev *rdev @@ got struct md_rdev [noderef] __rcu *rdev @@
drivers/md/raid10.c:1233:22: sparse: expected struct md_rdev *rdev
drivers/md/raid10.c:1233:22: sparse: got struct md_rdev [noderef] __rcu *rdev
>> drivers/md/raid10.c:1247:60: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected unsigned long const volatile *addr @@ got unsigned long [noderef] __rcu * @@
drivers/md/raid10.c:1247:60: sparse: expected unsigned long const volatile *addr
drivers/md/raid10.c:1247:60: sparse: got unsigned long [noderef] __rcu *
drivers/md/raid10.c:1576:22: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct md_rdev *rdev @@ got struct md_rdev [noderef] __rcu *replacement @@
drivers/md/raid10.c:1576:22: sparse: expected struct md_rdev *rdev
drivers/md/raid10.c:1576:22: sparse: got struct md_rdev [noderef] __rcu *replacement
drivers/md/raid10.c:1583:22: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct md_rdev *rdev @@ got struct md_rdev [noderef] __rcu *rdev @@
drivers/md/raid10.c:1583:22: sparse: expected struct md_rdev *rdev
drivers/md/raid10.c:1583:22: sparse: got struct md_rdev [noderef] __rcu *rdev
drivers/md/raid10.c:1982:22: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct md_rdev *rdev @@ got struct md_rdev [noderef] __rcu *rdev @@
drivers/md/raid10.c:1982:22: sparse: expected struct md_rdev *rdev
drivers/md/raid10.c:1982:22: sparse: got struct md_rdev [noderef] __rcu *rdev
drivers/md/raid10.c:2015:46: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected unsigned long const volatile *addr @@ got unsigned long [noderef] __rcu * @@
drivers/md/raid10.c:2015:46: sparse: expected unsigned long const volatile *addr
drivers/md/raid10.c:2015:46: sparse: got unsigned long [noderef] __rcu *
>> drivers/md/raid10.c:2016:55: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected unsigned long volatile *addr @@ got unsigned long [noderef] __rcu * @@
drivers/md/raid10.c:2016:55: sparse: expected unsigned long volatile *addr
drivers/md/raid10.c:2016:55: sparse: got unsigned long [noderef] __rcu *
drivers/md/raid10.c:2019:65: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected unsigned long volatile *addr @@ got unsigned long [noderef] __rcu * @@
drivers/md/raid10.c:2019:65: sparse: expected unsigned long volatile *addr
drivers/md/raid10.c:2019:65: sparse: got unsigned long [noderef] __rcu *
drivers/md/raid10.c:2026:53: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected unsigned long volatile *addr @@ got unsigned long [noderef] __rcu * @@
drivers/md/raid10.c:2026:53: sparse: expected unsigned long volatile *addr
drivers/md/raid10.c:2026:53: sparse: got unsigned long [noderef] __rcu *
drivers/md/raid10.c:2033:53: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected unsigned long const volatile *addr @@ got unsigned long [noderef] __rcu * @@
drivers/md/raid10.c:2033:53: sparse: expected unsigned long const volatile *addr
drivers/md/raid10.c:2033:53: sparse: got unsigned long [noderef] __rcu *
drivers/md/raid10.c:2034:62: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected unsigned long volatile *addr @@ got unsigned long [noderef] __rcu * @@
drivers/md/raid10.c:2034:62: sparse: expected unsigned long volatile *addr
drivers/md/raid10.c:2034:62: sparse: got unsigned long [noderef] __rcu *
drivers/md/raid10.c:2080:58: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected unsigned long const volatile *addr @@ got unsigned long [noderef] __rcu * @@
drivers/md/raid10.c:2080:58: sparse: expected unsigned long const volatile *addr
drivers/md/raid10.c:2080:58: sparse: got unsigned long [noderef] __rcu *
drivers/md/raid10.c:2124:18: sparse: sparse: incompatible types in comparison expression (different address spaces):
drivers/md/raid10.c:2124:18: sparse: struct md_rdev *
drivers/md/raid10.c:2124:18: sparse: struct md_rdev [noderef] __rcu *
drivers/md/raid10.c:2126:23: sparse: sparse: incompatible types in comparison expression (different address spaces):
drivers/md/raid10.c:2126:23: sparse: struct md_rdev *
drivers/md/raid10.c:2126:23: sparse: struct md_rdev [noderef] __rcu *
drivers/md/raid10.c:2141:48: sparse: sparse: incompatible types in comparison expression (different address spaces):
drivers/md/raid10.c:2141:48: sparse: struct md_rdev [noderef] __rcu *
drivers/md/raid10.c:2141:48: sparse: struct md_rdev *
>> drivers/md/raid10.c:2187:45: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected struct atomic_t [usertype] *v @@ got struct atomic_t [noderef] __rcu * @@
>> drivers/md/raid10.c:2192:42: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct md_rdev *rdev @@ got struct md_rdev [noderef] __rcu *rdev @@
drivers/md/raid10.c:2260:22: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct md_rdev *rdev @@ got struct md_rdev [noderef] __rcu *replacement @@
drivers/md/raid10.c:2262:22: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct md_rdev *rdev @@ got struct md_rdev [noderef] __rcu *rdev @@
drivers/md/raid10.c:2341:22: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct md_rdev *rdev @@ got struct md_rdev [noderef] __rcu *rdev @@
drivers/md/raid10.c:2387:45: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct atomic_t [usertype] *v @@ got struct atomic_t [noderef] __rcu * @@
drivers/md/raid10.c:2391:57: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected unsigned long const volatile *addr @@ got unsigned long [noderef] __rcu * @@
drivers/md/raid10.c:2462:22: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct md_rdev *rdev @@ got struct md_rdev [noderef] __rcu *rdev @@
drivers/md/raid10.c:2470:30: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct md_rdev *rdev @@ got struct md_rdev [noderef] __rcu *rdev @@
drivers/md/raid10.c:2492:34: sparse: sparse: incompatible types in comparison expression (different address spaces):
drivers/md/raid10.c:2492:34: sparse: struct md_rdev *
drivers/md/raid10.c:2492:34: sparse: struct md_rdev [noderef] __rcu *
drivers/md/raid10.c:2543:45: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct atomic_t [usertype] *v @@ got struct atomic_t [noderef] __rcu * @@
drivers/md/raid10.c:2548:45: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct atomic_t [usertype] *v @@ got struct atomic_t [noderef] __rcu * @@
drivers/md/raid10.c:2634:14: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct md_rdev *rdev @@ got struct md_rdev [noderef] __rcu *rdev @@
>> drivers/md/raid10.c:2703:30: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct md_rdev *[assigned] rdev @@ got struct md_rdev [noderef] __rcu *rdev @@
>> drivers/md/raid10.c:2813:70: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected struct md_rdev *rdev @@ got struct md_rdev [noderef] __rcu *rdev @@
drivers/md/raid10.c:2918:30: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct md_rdev *rdev @@ got struct md_rdev [noderef] __rcu *rdev @@
drivers/md/raid10.c:2934:30: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct md_rdev *rdev @@ got struct md_rdev [noderef] __rcu *replacement @@
drivers/md/raid10.c:2958:30: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct md_rdev *rdev @@ got struct md_rdev [noderef] __rcu *rdev @@
drivers/md/raid10.c:2975:30: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct md_rdev *rdev @@ got struct md_rdev [noderef] __rcu *replacement @@
drivers/md/raid10.c:3571:72: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected unsigned long const volatile *addr @@ got unsigned long [noderef] __rcu * @@
drivers/md/raid10.c:3697:74: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct md_rdev *rdev @@ got struct md_rdev [noderef] __rcu *rdev @@
>> drivers/md/raid10.c:3702:65: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct md_rdev *rdev @@ got struct md_rdev [noderef] __rcu *replacement @@
>> drivers/md/raid10.c:4088:43: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct md_rdev [noderef] __rcu *replacement @@ got struct md_rdev *[assigned] rdev @@
>> drivers/md/raid10.c:4092:36: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct md_rdev [noderef] __rcu *rdev @@ got struct md_rdev *[assigned] rdev @@
drivers/md/raid10.c:4150:53: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected unsigned long volatile *addr @@ got unsigned long [noderef] __rcu * @@
drivers/md/raid10.c:4154:45: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected unsigned long const volatile *addr @@ got unsigned long [noderef] __rcu * @@
drivers/md/raid10.c:4163:45: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected unsigned long const volatile *addr @@ got unsigned long [noderef] __rcu * @@
>> drivers/md/raid10.c:2014:27: sparse: sparse: dereference of noderef expression
drivers/md/raid10.c:2028:44: sparse: sparse: dereference of noderef expression
drivers/md/raid10.c:2028:44: sparse: sparse: dereference of noderef expression
drivers/md/raid10.c:2030:53: sparse: sparse: dereference of noderef expression
drivers/md/raid10.c:2030:53: sparse: sparse: dereference of noderef expression
drivers/md/raid10.c:2032:34: sparse: sparse: dereference of noderef expression
drivers/md/raid10.c:2036:53: sparse: sparse: dereference of noderef expression
drivers/md/raid10.c:2036:53: sparse: sparse: dereference of noderef expression
drivers/md/raid10.c:2389:46: sparse: sparse: dereference of noderef expression
drivers/md/raid10.c:2389:46: sparse: sparse: dereference of noderef expression
drivers/md/raid10.c:2393:60: sparse: sparse: dereference of noderef expression
drivers/md/raid10.c:2394:17: sparse: sparse: dereference of noderef expression
drivers/md/raid10.c:2394:17: sparse: sparse: dereference of noderef expression
drivers/md/raid10.c:2394:17: sparse: sparse: dereference of noderef expression
drivers/md/raid10.c:2412:46: sparse: sparse: dereference of noderef expression
drivers/md/raid10.c:2412:46: sparse: sparse: dereference of noderef expression
drivers/md/raid10.c:2544:46: sparse: sparse: dereference of noderef expression
drivers/md/raid10.c:2544:46: sparse: sparse: dereference of noderef expression
drivers/md/raid10.c:2549:46: sparse: sparse: dereference of noderef expression
drivers/md/raid10.c:2549:46: sparse: sparse: dereference of noderef expression
drivers/md/raid10.c:4158:33: sparse: sparse: dereference of noderef expression
drivers/md/raid10.c:4164:25: sparse: sparse: dereference of noderef expression

vim +5128 drivers/md/raid10.c

3ea7daa5d7fde47 NeilBrown 2012-05-22 5115
4246a0b63bd8f56 Christoph Hellwig 2015-07-20 5116 static void end_reshape_write(struct bio *bio)
3ea7daa5d7fde47 NeilBrown 2012-05-22 5117 {
f0250618361db14 Ming Lei 2017-03-17 5118 struct r10bio *r10_bio = get_resync_r10bio(bio);
3ea7daa5d7fde47 NeilBrown 2012-05-22 5119 struct mddev *mddev = r10_bio->mddev;
3ea7daa5d7fde47 NeilBrown 2012-05-22 5120 struct r10conf *conf = mddev->private;
3ea7daa5d7fde47 NeilBrown 2012-05-22 5121 int d;
3ea7daa5d7fde47 NeilBrown 2012-05-22 5122 int slot;
3ea7daa5d7fde47 NeilBrown 2012-05-22 5123 int repl;
3ea7daa5d7fde47 NeilBrown 2012-05-22 5124 struct md_rdev *rdev = NULL;
3ea7daa5d7fde47 NeilBrown 2012-05-22 5125
3ea7daa5d7fde47 NeilBrown 2012-05-22 5126 d = find_bio_disk(conf, r10_bio, bio, &slot, &repl);
3ea7daa5d7fde47 NeilBrown 2012-05-22 5127 if (repl)
3ea7daa5d7fde47 NeilBrown 2012-05-22 @5128 rdev = conf->mirrors[d].replacement;
3ea7daa5d7fde47 NeilBrown 2012-05-22 5129 if (!rdev) {
3ea7daa5d7fde47 NeilBrown 2012-05-22 5130 smp_mb();
3ea7daa5d7fde47 NeilBrown 2012-05-22 @5131 rdev = conf->mirrors[d].rdev;
3ea7daa5d7fde47 NeilBrown 2012-05-22 5132 }
3ea7daa5d7fde47 NeilBrown 2012-05-22 5133
4e4cbee93d56137 Christoph Hellwig 2017-06-03 5134 if (bio->bi_status) {
3ea7daa5d7fde47 NeilBrown 2012-05-22 5135 /* FIXME should record badblock */
3ea7daa5d7fde47 NeilBrown 2012-05-22 5136 md_error(mddev, rdev);
3ea7daa5d7fde47 NeilBrown 2012-05-22 5137 }
3ea7daa5d7fde47 NeilBrown 2012-05-22 5138
3ea7daa5d7fde47 NeilBrown 2012-05-22 5139 rdev_dec_pending(rdev, mddev);
3ea7daa5d7fde47 NeilBrown 2012-05-22 5140 end_reshape_request(r10_bio);
3ea7daa5d7fde47 NeilBrown 2012-05-22 5141 }
3ea7daa5d7fde47 NeilBrown 2012-05-22 5142

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

Attachment: .config.gz
Description: application/gzip