All of lore.kernel.org
 help / color / mirror / Atom feed
* [android-common:android-mainline 2/2] block/blk-merge.c:1006 blk_rq_merge_ok() warn: variable dereferenced before check 'rq->bio' (see line 995)
@ 2025-03-05 12:32 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2025-03-05 12:32 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: cros-kernel-buildreports@googlegroups.com

tree:   https://android.googlesource.com/kernel/common android-mainline
head:   41a0b7bfea10dffbd255cc0978b755dc0f427832
commit: 61952bb73486fff0f5550bccdf4062d9dd0fb163 [2/2] block: remove the write_hint field from struct request
:::::: branch date: 16 hours ago
:::::: commit date: 4 months ago
config: i386-randconfig-141-20250305 (https://download.01.org/0day-ci/archive/20250305/202503052040.TSXL8cXi-lkp@intel.com/config)
compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90)

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>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202503052040.TSXL8cXi-lkp@intel.com/

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

vim +1006 block/blk-merge.c

050c8ea80e3e90 Tejun Heo          2012-02-08   981  
050c8ea80e3e90 Tejun Heo          2012-02-08   982  bool blk_rq_merge_ok(struct request *rq, struct bio *bio)
050c8ea80e3e90 Tejun Heo          2012-02-08   983  {
e2a60da74fc821 Martin K. Petersen 2012-09-18   984  	if (!rq_mergeable(rq) || !bio_mergeable(bio))
050c8ea80e3e90 Tejun Heo          2012-02-08   985  		return false;
050c8ea80e3e90 Tejun Heo          2012-02-08   986  
288dab8a35a0bd Christoph Hellwig  2016-06-09   987  	if (req_op(rq) != bio_op(bio))
f31dc1cd490539 Martin K. Petersen 2012-09-18   988  		return false;
f31dc1cd490539 Martin K. Petersen 2012-09-18   989  
050c8ea80e3e90 Tejun Heo          2012-02-08   990  	/* different data direction or already started, don't merge */
050c8ea80e3e90 Tejun Heo          2012-02-08   991  	if (bio_data_dir(bio) != rq_data_dir(rq))
050c8ea80e3e90 Tejun Heo          2012-02-08   992  		return false;
050c8ea80e3e90 Tejun Heo          2012-02-08   993  
6b2b04590b51aa Tejun Heo          2022-03-14   994  	/* don't merge across cgroup boundaries */
6b2b04590b51aa Tejun Heo          2022-03-14  @995  	if (!blk_cgroup_mergeable(rq, bio))
6b2b04590b51aa Tejun Heo          2022-03-14   996  		return false;
6b2b04590b51aa Tejun Heo          2022-03-14   997  
050c8ea80e3e90 Tejun Heo          2012-02-08   998  	/* only merge integrity protected bio into ditto rq */
4eaf99beadcefb Martin K. Petersen 2014-09-26   999  	if (blk_integrity_merge_bio(rq->q, rq, bio) == false)
050c8ea80e3e90 Tejun Heo          2012-02-08  1000  		return false;
050c8ea80e3e90 Tejun Heo          2012-02-08  1001  
a892c8d52c0228 Satya Tangirala    2020-05-14  1002  	/* Only merge if the crypt contexts are compatible */
a892c8d52c0228 Satya Tangirala    2020-05-14  1003  	if (!bio_crypt_rq_ctx_compatible(rq, bio))
a892c8d52c0228 Satya Tangirala    2020-05-14  1004  		return false;
a892c8d52c0228 Satya Tangirala    2020-05-14  1005  
61952bb73486ff Christoph Hellwig  2024-11-12 @1006  	if (rq->bio) {
449813515d3e5e Bart Van Assche    2024-02-02  1007  		/* Don't merge requests with different write hints. */
61952bb73486ff Christoph Hellwig  2024-11-12  1008  		if (rq->bio->bi_write_hint != bio->bi_write_hint)
449813515d3e5e Bart Van Assche    2024-02-02  1009  			return false;
61952bb73486ff Christoph Hellwig  2024-11-12  1010  	}
449813515d3e5e Bart Van Assche    2024-02-02  1011  
668ffc03418bc7 Damien Le Moal     2018-11-20  1012  	if (rq->ioprio != bio_prio(bio))
668ffc03418bc7 Damien Le Moal     2018-11-20  1013  		return false;
668ffc03418bc7 Damien Le Moal     2018-11-20  1014  
9da3d1e912f395 John Garry         2024-06-20  1015  	if (blk_atomic_write_mergeable_rq_bio(rq, bio) == false)
9da3d1e912f395 John Garry         2024-06-20  1016  		return false;
9da3d1e912f395 John Garry         2024-06-20  1017  
050c8ea80e3e90 Tejun Heo          2012-02-08  1018  	return true;
050c8ea80e3e90 Tejun Heo          2012-02-08  1019  }
050c8ea80e3e90 Tejun Heo          2012-02-08  1020  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 2+ messages in thread
* [android-common:android-mainline 2/2] block/blk-merge.c:1006 blk_rq_merge_ok() warn: variable dereferenced before check 'rq->bio' (see line 995)
@ 2025-03-05 12:43 Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2025-03-05 12:43 UTC (permalink / raw)
  To: oe-kbuild, cros-kernel-buildreports; +Cc: lkp, oe-kbuild-all

tree:   https://android.googlesource.com/kernel/common android-mainline
head:   41a0b7bfea10dffbd255cc0978b755dc0f427832
commit: 61952bb73486fff0f5550bccdf4062d9dd0fb163 [2/2] block: remove the write_hint field from struct request
config: i386-randconfig-141-20250305 (https://download.01.org/0day-ci/archive/20250305/202503052040.TSXL8cXi-lkp@intel.com/config)
compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90)

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>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202503052040.TSXL8cXi-lkp@intel.com/

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

vim +1006 block/blk-merge.c

050c8ea80e3e90 Tejun Heo          2012-02-08   982  bool blk_rq_merge_ok(struct request *rq, struct bio *bio)
050c8ea80e3e90 Tejun Heo          2012-02-08   983  {
e2a60da74fc821 Martin K. Petersen 2012-09-18   984  	if (!rq_mergeable(rq) || !bio_mergeable(bio))
050c8ea80e3e90 Tejun Heo          2012-02-08   985  		return false;
050c8ea80e3e90 Tejun Heo          2012-02-08   986  
288dab8a35a0bd Christoph Hellwig  2016-06-09   987  	if (req_op(rq) != bio_op(bio))
f31dc1cd490539 Martin K. Petersen 2012-09-18   988  		return false;
f31dc1cd490539 Martin K. Petersen 2012-09-18   989  
050c8ea80e3e90 Tejun Heo          2012-02-08   990  	/* different data direction or already started, don't merge */
050c8ea80e3e90 Tejun Heo          2012-02-08   991  	if (bio_data_dir(bio) != rq_data_dir(rq))
050c8ea80e3e90 Tejun Heo          2012-02-08   992  		return false;
050c8ea80e3e90 Tejun Heo          2012-02-08   993  
6b2b04590b51aa Tejun Heo          2022-03-14   994  	/* don't merge across cgroup boundaries */
6b2b04590b51aa Tejun Heo          2022-03-14  @995  	if (!blk_cgroup_mergeable(rq, bio))

rq->bio dereferenced inside the function.

6b2b04590b51aa Tejun Heo          2022-03-14   996  		return false;
6b2b04590b51aa Tejun Heo          2022-03-14   997  
050c8ea80e3e90 Tejun Heo          2012-02-08   998  	/* only merge integrity protected bio into ditto rq */
4eaf99beadcefb Martin K. Petersen 2014-09-26   999  	if (blk_integrity_merge_bio(rq->q, rq, bio) == false)
050c8ea80e3e90 Tejun Heo          2012-02-08  1000  		return false;
050c8ea80e3e90 Tejun Heo          2012-02-08  1001  
a892c8d52c0228 Satya Tangirala    2020-05-14  1002  	/* Only merge if the crypt contexts are compatible */
a892c8d52c0228 Satya Tangirala    2020-05-14  1003  	if (!bio_crypt_rq_ctx_compatible(rq, bio))
a892c8d52c0228 Satya Tangirala    2020-05-14  1004  		return false;
a892c8d52c0228 Satya Tangirala    2020-05-14  1005  
61952bb73486ff Christoph Hellwig  2024-11-12 @1006  	if (rq->bio) {

Checked too late

449813515d3e5e Bart Van Assche    2024-02-02  1007  		/* Don't merge requests with different write hints. */
61952bb73486ff Christoph Hellwig  2024-11-12  1008  		if (rq->bio->bi_write_hint != bio->bi_write_hint)
449813515d3e5e Bart Van Assche    2024-02-02  1009  			return false;
61952bb73486ff Christoph Hellwig  2024-11-12  1010  	}
449813515d3e5e Bart Van Assche    2024-02-02  1011  
668ffc03418bc7 Damien Le Moal     2018-11-20  1012  	if (rq->ioprio != bio_prio(bio))
668ffc03418bc7 Damien Le Moal     2018-11-20  1013  		return false;
668ffc03418bc7 Damien Le Moal     2018-11-20  1014  
9da3d1e912f395 John Garry         2024-06-20  1015  	if (blk_atomic_write_mergeable_rq_bio(rq, bio) == false)
9da3d1e912f395 John Garry         2024-06-20  1016  		return false;
9da3d1e912f395 John Garry         2024-06-20  1017  
050c8ea80e3e90 Tejun Heo          2012-02-08  1018  	return true;
050c8ea80e3e90 Tejun Heo          2012-02-08  1019  }

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-03-05 12:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-05 12:32 [android-common:android-mainline 2/2] block/blk-merge.c:1006 blk_rq_merge_ok() warn: variable dereferenced before check 'rq->bio' (see line 995) kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2025-03-05 12:43 Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.