[android-common:android16-6.12 1/1] block/blk-merge.c:969 blk_rq_merge_ok() warn: variable dereferenced before check 'rq->bio' (see line 958)

kernel test robot <[email protected]>
Newsgroups dev.linux.lists.oe-kbuild
Message-ID <[email protected]>
BCC: [email protected]
CC: [email protected]
TO: [email protected]

tree:   https://android.googlesource.com/kernel/common android16-6.12
head:   d36feda1de5741a9d2bfe0fd6a0391c77047f5bb
commit: 7f82cf03ba776076d22aebf90449ec2b83618cef [1/1] UPSTREAM: block: remove the write_hint field from struct request
:::::: branch date: 12 hours ago
:::::: commit date: 11 months ago
config: x86_64-randconfig-161 (https://download.01.org/0day-ci/archive/20260703/[email protected]/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
smatch: v0.5.0-9185-gbcc58b9c

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 <[email protected]>
| Reported-by: Dan Carpenter <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

smatch warnings:
block/blk-merge.c:969 blk_rq_merge_ok() warn: variable dereferenced before check 'rq->bio' (see line 958)

vim +969 block/blk-merge.c

050c8ea80e3e900 Tejun Heo          2012-02-08  944  
050c8ea80e3e900 Tejun Heo          2012-02-08  945  bool blk_rq_merge_ok(struct request *rq, struct bio *bio)
050c8ea80e3e900 Tejun Heo          2012-02-08  946  {
e2a60da74fc8215 Martin K. Petersen 2012-09-18  947  	if (!rq_mergeable(rq) || !bio_mergeable(bio))
050c8ea80e3e900 Tejun Heo          2012-02-08  948  		return false;
050c8ea80e3e900 Tejun Heo          2012-02-08  949  
288dab8a35a0bde Christoph Hellwig  2016-06-09  950  	if (req_op(rq) != bio_op(bio))
f31dc1cd490539e Martin K. Petersen 2012-09-18  951  		return false;
f31dc1cd490539e Martin K. Petersen 2012-09-18  952  
050c8ea80e3e900 Tejun Heo          2012-02-08  953  	/* different data direction or already started, don't merge */
050c8ea80e3e900 Tejun Heo          2012-02-08  954  	if (bio_data_dir(bio) != rq_data_dir(rq))
050c8ea80e3e900 Tejun Heo          2012-02-08  955  		return false;
050c8ea80e3e900 Tejun Heo          2012-02-08  956  
6b2b04590b51aa4 Tejun Heo          2022-03-14  957  	/* don't merge across cgroup boundaries */
6b2b04590b51aa4 Tejun Heo          2022-03-14 @958  	if (!blk_cgroup_mergeable(rq, bio))
6b2b04590b51aa4 Tejun Heo          2022-03-14  959  		return false;
6b2b04590b51aa4 Tejun Heo          2022-03-14  960  
050c8ea80e3e900 Tejun Heo          2012-02-08  961  	/* only merge integrity protected bio into ditto rq */
4eaf99beadcefbf Martin K. Petersen 2014-09-26  962  	if (blk_integrity_merge_bio(rq->q, rq, bio) == false)
050c8ea80e3e900 Tejun Heo          2012-02-08  963  		return false;
050c8ea80e3e900 Tejun Heo          2012-02-08  964  
a892c8d52c02284 Satya Tangirala    2020-05-14  965  	/* Only merge if the crypt contexts are compatible */
a892c8d52c02284 Satya Tangirala    2020-05-14  966  	if (!bio_crypt_rq_ctx_compatible(rq, bio))
a892c8d52c02284 Satya Tangirala    2020-05-14  967  		return false;
a892c8d52c02284 Satya Tangirala    2020-05-14  968  
7f82cf03ba77607 Christoph Hellwig  2024-11-12 @969  	if (rq->bio) {
449813515d3e5ef Bart Van Assche    2024-02-02  970  		/* Don't merge requests with different write hints. */
7f82cf03ba77607 Christoph Hellwig  2024-11-12  971  		if (rq->bio->bi_write_hint != bio->bi_write_hint)
449813515d3e5ef Bart Van Assche    2024-02-02  972  			return false;
7f82cf03ba77607 Christoph Hellwig  2024-11-12  973  	}
668ffc03418bc77 Damien Le Moal     2018-11-20  974  
69db0304309a7e4 Greg Kroah-Hartman 2025-05-21  975  	if (rq->ioprio != bio_prio(bio))
69db0304309a7e4 Greg Kroah-Hartman 2025-05-21  976  		return false;
69db0304309a7e4 Greg Kroah-Hartman 2025-05-21  977  
9da3d1e912f3953 John Garry         2024-06-20  978  	if (blk_atomic_write_mergeable_rq_bio(rq, bio) == false)
9da3d1e912f3953 John Garry         2024-06-20  979  		return false;
9da3d1e912f3953 John Garry         2024-06-20  980  
050c8ea80e3e900 Tejun Heo          2012-02-08  981  	return true;
050c8ea80e3e900 Tejun Heo          2012-02-08  982  }
050c8ea80e3e900 Tejun Heo          2012-02-08  983  

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.