tree: https://gitee.com/openeuler/kernel.git OLK-5.10 head: 5d73ae1b79c0e467e87e2f0494211ff38732900d commit: 8a6bee347626968d467aef07453c4547bc23cb64 [2415/2415] blk-mq: fix potential uaf for 'queue_hw_ctx' config: x86_64-randconfig-121-20241111 (https://download.01.org/0day-ci/archive/20241126/202411261052.IHgWOk06-lkp@i...) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241126/202411261052.IHgWOk06-lkp@i...)
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@intel.com | Closes: https://lore.kernel.org/oe-kbuild-all/202411261052.IHgWOk06-lkp@intel.com/
sparse warnings: (new ones prefixed by >>) block/blk-sysfs.c: note: in included file:
include/linux/blk-mq.h:620:18: sparse: sparse: incompatible types in comparison expression (different address spaces):
include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu *[noderef] __rcu * include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu ** -- block/blk-mq-tag.c: note: in included file:
include/linux/blk-mq.h:620:18: sparse: sparse: incompatible types in comparison expression (different address spaces):
include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu *[noderef] __rcu * include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu ** --
block/blk-mq-sysfs.c:339:55: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct blk_mq_hw_ctx *hctx @@ got struct blk_mq_hw_ctx [noderef] __rcu * @@
block/blk-mq-sysfs.c:339:55: sparse: expected struct blk_mq_hw_ctx *hctx block/blk-mq-sysfs.c:339:55: sparse: got struct blk_mq_hw_ctx [noderef] __rcu * block/blk-mq-sysfs.c: note: in included file:
include/linux/blk-mq.h:620:18: sparse: sparse: incompatible types in comparison expression (different address spaces):
include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu *[noderef] __rcu * include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu **
include/linux/blk-mq.h:620:18: sparse: sparse: incompatible types in comparison expression (different address spaces):
include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu *[noderef] __rcu * include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu **
include/linux/blk-mq.h:620:18: sparse: sparse: incompatible types in comparison expression (different address spaces):
include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu *[noderef] __rcu * include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu **
include/linux/blk-mq.h:620:18: sparse: sparse: incompatible types in comparison expression (different address spaces):
include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu *[noderef] __rcu * include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu ** -- block/blk-mq-sched.c: note: in included file:
include/linux/blk-mq.h:620:18: sparse: sparse: incompatible types in comparison expression (different address spaces):
include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu *[noderef] __rcu * include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu **
include/linux/blk-mq.h:620:18: sparse: sparse: incompatible types in comparison expression (different address spaces):
include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu *[noderef] __rcu * include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu **
include/linux/blk-mq.h:620:18: sparse: sparse: incompatible types in comparison expression (different address spaces):
include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu *[noderef] __rcu * include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu **
include/linux/blk-mq.h:620:18: sparse: sparse: incompatible types in comparison expression (different address spaces):
include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu *[noderef] __rcu * include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu **
include/linux/blk-mq.h:620:18: sparse: sparse: incompatible types in comparison expression (different address spaces):
include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu *[noderef] __rcu * include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu ** --
block/blk-mq.c:485:19: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct blk_mq_hw_ctx *hctx @@ got struct blk_mq_hw_ctx [noderef] __rcu * @@
block/blk-mq.c:485:19: sparse: expected struct blk_mq_hw_ctx *hctx block/blk-mq.c:485:19: sparse: got struct blk_mq_hw_ctx [noderef] __rcu *
block/blk-mq.c:3270:41: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected struct blk_mq_hw_ctx **hctxs @@ got struct blk_mq_hw_ctx [noderef] __rcu **queue_hw_ctx @@
block/blk-mq.c:3270:41: sparse: expected struct blk_mq_hw_ctx **hctxs block/blk-mq.c:3270:41: sparse: got struct blk_mq_hw_ctx [noderef] __rcu **queue_hw_ctx
block/blk-mq.c:3284:17: sparse: sparse: incompatible types in comparison expression (different address spaces):
block/blk-mq.c:3284:17: sparse: struct blk_mq_hw_ctx [noderef] __rcu *[noderef] __rcu * block/blk-mq.c:3284:17: sparse: struct blk_mq_hw_ctx [noderef] __rcu ** block/blk-mq.c:4033:14: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct blk_mq_hw_ctx *hctx @@ got struct blk_mq_hw_ctx [noderef] __rcu * @@ block/blk-mq.c: note: in included file:
include/linux/blk-mq.h:620:18: sparse: sparse: incompatible types in comparison expression (different address spaces):
include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu *[noderef] __rcu * include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu **
include/linux/blk-mq.h:620:18: sparse: sparse: incompatible types in comparison expression (different address spaces):
include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu *[noderef] __rcu * include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu **
include/linux/blk-mq.h:620:18: sparse: sparse: incompatible types in comparison expression (different address spaces):
include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu *[noderef] __rcu * include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu **
include/linux/blk-mq.h:620:18: sparse: sparse: incompatible types in comparison expression (different address spaces):
include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu *[noderef] __rcu * include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu **
include/linux/blk-mq.h:620:18: sparse: sparse: incompatible types in comparison expression (different address spaces):
include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu *[noderef] __rcu * include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu **
include/linux/blk-mq.h:620:18: sparse: sparse: incompatible types in comparison expression (different address spaces):
include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu *[noderef] __rcu * include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu **
include/linux/blk-mq.h:620:18: sparse: sparse: incompatible types in comparison expression (different address spaces):
include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu *[noderef] __rcu * include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu **
include/linux/blk-mq.h:620:18: sparse: sparse: incompatible types in comparison expression (different address spaces):
include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu *[noderef] __rcu * include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu **
include/linux/blk-mq.h:620:18: sparse: sparse: incompatible types in comparison expression (different address spaces):
include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu *[noderef] __rcu * include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu **
include/linux/blk-mq.h:620:18: sparse: sparse: incompatible types in comparison expression (different address spaces):
include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu *[noderef] __rcu * include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu **
include/linux/blk-mq.h:620:18: sparse: sparse: incompatible types in comparison expression (different address spaces):
include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu *[noderef] __rcu * include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu **
include/linux/blk-mq.h:620:18: sparse: sparse: incompatible types in comparison expression (different address spaces):
include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu *[noderef] __rcu * include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu **
include/linux/blk-mq.h:620:18: sparse: sparse: incompatible types in comparison expression (different address spaces):
include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu *[noderef] __rcu * include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu **
include/linux/blk-mq.h:620:18: sparse: sparse: incompatible types in comparison expression (different address spaces):
include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu *[noderef] __rcu * include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu **
include/linux/blk-mq.h:620:18: sparse: sparse: incompatible types in comparison expression (different address spaces):
include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu *[noderef] __rcu * include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu **
include/linux/blk-mq.h:620:18: sparse: sparse: incompatible types in comparison expression (different address spaces):
include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu *[noderef] __rcu * include/linux/blk-mq.h:620:18: sparse: struct blk_mq_hw_ctx [noderef] __rcu **
vim +620 include/linux/blk-mq.h
614 615 static inline struct blk_mq_hw_ctx *queue_hctx(struct request_queue *q, int id) 616 { 617 struct blk_mq_hw_ctx *hctx; 618 619 rcu_read_lock();
620 hctx = *(rcu_dereference(q->queue_hw_ctx) + id);
621 rcu_read_unlock(); 622 623 return hctx; 624 } 625