All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: [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)
Date: Wed, 5 Mar 2025 20:32:45 +0800	[thread overview]
Message-ID: <202503052040.TSXL8cXi-lkp@intel.com> (raw)

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

             reply	other threads:[~2025-03-05 12:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-05 12:32 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-03-05 12:43 [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) Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202503052040.TSXL8cXi-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=error27@gmail.com \
    --cc=oe-kbuild@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.