mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Alasdair Kergon <agk@redhat.com>,
	Mike Snitzer <snitzer@redhat.com>,
	dm-devel@redhat.com
Cc: Arnd Bergmann <arnd@arndb.de>, Jens Axboe <axboe@kernel.dk>,
	Hannes Reinecke <hare@suse.com>,
	Bart Van Assche <bart.vanassche@wdc.com>,
	NeilBrown <neilb@suse.com>, Mikulas Patocka <mpatocka@redhat.com>,
	Dan Williams <dan.j.williams@intel.com>,
	Damien Le Moal <damien.lemoal@wdc.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] dm: fix uninitialized variable reference
Date: Mon, 11 Dec 2017 12:33:45 +0100	[thread overview]
Message-ID: <20171211113358.3599287-1-arnd@arndb.de> (raw)

The last bugfix apparently introduced another problem, as shown
by this gcc warning:

drivers/md/dm.c: In function '__send_changing_extent_only':
drivers/md/dm.c:1365:28: error: 'ti' is used uninitialized in this function [-Werror=uninitialized]

This restores the intialization of the 'ti' variable.

Fixes: aecefd4919de ("dm: fix __send_changing_extent_only() to send first bio and chain remainder")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
I did not test this or give the patch much thought, this just seemed
to be the most likely fix I could come up with in a short time, so
please review carefully, and ignore if the solution is something
else.
---
 drivers/md/dm.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 05aa9c094352..f19e9787076e 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -1356,6 +1356,10 @@ static int __send_changing_extent_only(struct clone_info *ci,
 	unsigned len;
 	unsigned num_bios;
 
+	ti = dm_table_find_target(ci->map, ci->sector);
+	if (!dm_target_is_valid(ti))
+		return -EIO;
+
 	/*
 	 * Even though the device advertised support for this type of
 	 * request, that does not mean every target supports it, and
-- 
2.9.0

             reply	other threads:[~2017-12-11 11:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-11 11:33 Arnd Bergmann [this message]
2017-12-11 13:50 ` Mike Snitzer
2017-12-11 15:50   ` Arnd Bergmann

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=20171211113358.3599287-1-arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=agk@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=bart.vanassche@wdc.com \
    --cc=damien.lemoal@wdc.com \
    --cc=dan.j.williams@intel.com \
    --cc=dm-devel@redhat.com \
    --cc=hare@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpatocka@redhat.com \
    --cc=neilb@suse.com \
    --cc=snitzer@redhat.com \
    /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®