From: Dan Carpenter <dan.carpenter@linaro.org>
To: oe-kbuild@lists.linux.dev,
"Christoph Böhmwalder" <christoph.boehmwalder@linbit.com>
Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev,
linux-kernel@vger.kernel.org, Jens Axboe <axboe@kernel.dk>
Subject: drivers/block/drbd/drbd_worker.c:588 make_resync_request() warn: variable dereferenced before check 'peer_device' (see line 587)
Date: Tue, 3 Oct 2023 11:54:13 +0300 [thread overview]
Message-ID: <ace247b3-1a4f-43bb-a0ca-49665a1bb410@kadam.mountain> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: ce36c8b149873b50f2a4b9818eb3dcdd74ddd5a3
commit: 0d11f3cf279c5ad20a41f29242f170ba3c02f2da drbd: Pass a peer device to the resync and online verify functions
config: x86_64-randconfig-161-20231003 (https://download.01.org/0day-ci/archive/20231003/202310030935.6F0FaCJy-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20231003/202310030935.6F0FaCJy-lkp@intel.com/reproduce)
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/202310030935.6F0FaCJy-lkp@intel.com/
smatch warnings:
drivers/block/drbd/drbd_worker.c:588 make_resync_request() warn: variable dereferenced before check 'peer_device' (see line 587)
vim +/peer_device +588 drivers/block/drbd/drbd_worker.c
0d11f3cf279c5a Christoph Böhmwalder 2023-03-30 585 static int make_resync_request(struct drbd_peer_device *const peer_device, int cancel)
b411b3637fa71f Philipp Reisner 2009-09-25 586 {
0d11f3cf279c5a Christoph Böhmwalder 2023-03-30 @587 struct drbd_device *const device = peer_device->device;
^^^^^^^^^^^^^^^^^^^^
Dereference
44a4d551846b8c Lars Ellenberg 2013-11-22 @588 struct drbd_connection *const connection = peer_device ? peer_device->connection : NULL;
^^^^^^^^^^^
Checked too late. The zero day bot sent this warning earlier and I try
not to resend warnings but no one responded to the first one. The
peer_device pointer comes from a list_first_entry_or_null() so that
suggests it can be NULL.
b411b3637fa71f Philipp Reisner 2009-09-25 589 unsigned long bit;
b411b3637fa71f Philipp Reisner 2009-09-25 590 sector_t sector;
155bd9d1abd604 Christoph Hellwig 2020-09-25 591 const sector_t capacity = get_capacity(device->vdisk);
1816a2b47afae8 Lars Ellenberg 2010-11-11 592 int max_bio_size;
e65f440d474d7d Lars Ellenberg 2010-11-05 593 int number, rollback_i, size;
506afb6248af57 Lars Ellenberg 2014-01-31 594 int align, requeue = 0;
0f0601f4ea2f53 Lars Ellenberg 2010-08-11 595 int i = 0;
92d94ae66aebda Philipp Reisner 2016-06-14 596 int discard_granularity = 0;
b411b3637fa71f Philipp Reisner 2009-09-25 597
b411b3637fa71f Philipp Reisner 2009-09-25 598 if (unlikely(cancel))
99920dc5c5fe52 Andreas Gruenbacher 2011-03-16 599 return 0;
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next reply other threads:[~2023-10-03 8:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-03 8:54 Dan Carpenter [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-10-11 7:21 Dan Carpenter
2023-07-21 5:48 Dan Carpenter
2023-05-22 6:52 Dan Carpenter
2023-05-16 6:32 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=ace247b3-1a4f-43bb-a0ca-49665a1bb410@kadam.mountain \
--to=dan.carpenter@linaro.org \
--cc=axboe@kernel.dk \
--cc=christoph.boehmwalder@linbit.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=oe-kbuild-all@lists.linux.dev \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®