All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dm: fix uninitialized variable reference
@ 2017-12-11 11:33 Arnd Bergmann
  2017-12-11 13:50 ` Mike Snitzer
  0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2017-12-11 11:33 UTC (permalink / raw)
  To: Alasdair Kergon, Mike Snitzer, dm-devel
  Cc: Arnd Bergmann, Jens Axboe, Hannes Reinecke, Bart Van Assche,
	NeilBrown, Mikulas Patocka, Dan Williams, Damien Le Moal,
	linux-kernel

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

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

* Re: dm: fix uninitialized variable reference
  2017-12-11 11:33 [PATCH] dm: fix uninitialized variable reference Arnd Bergmann
@ 2017-12-11 13:50 ` Mike Snitzer
  2017-12-11 15:50   ` Arnd Bergmann
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Snitzer @ 2017-12-11 13:50 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Alasdair Kergon, dm-devel, Jens Axboe, Hannes Reinecke,
	Bart Van Assche, NeilBrown, Mikulas Patocka, Dan Williams,
	Damien Le Moal, linux-kernel

On Mon, Dec 11 2017 at  6:33am -0500,
Arnd Bergmann <arnd@arndb.de> wrote:

> 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
> 

Already resolved this thanks to Stephen Rothwell's earlier
(substantially more discrete) mail.

I always enjoy a good public shaming but this cc list is particularly
wide.  Why?

Anyway, I resolved this differently:
https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git/commit/?h=dm-4.16&id=496cc64f4d10ba112aa0679a3bf29ae6ea74ff3d

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

* Re: dm: fix uninitialized variable reference
  2017-12-11 13:50 ` Mike Snitzer
@ 2017-12-11 15:50   ` Arnd Bergmann
  0 siblings, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2017-12-11 15:50 UTC (permalink / raw)
  To: Mike Snitzer
  Cc: Alasdair Kergon, dm-devel, Jens Axboe, Hannes Reinecke,
	Bart Van Assche, NeilBrown, Mikulas Patocka, Dan Williams,
	Damien Le Moal, Linux Kernel Mailing List

On Mon, Dec 11, 2017 at 2:50 PM, Mike Snitzer <snitzer@redhat.com> wrote:
> On Mon, Dec 11 2017 at  6:33am -0500,
> Arnd Bergmann <arnd@arndb.de> wrote:
>>
>
> Already resolved this thanks to Stephen Rothwell's earlier
> (substantially more discrete) mail.
>
> I always enjoy a good public shaming but this cc list is particularly
> wide.  Why?

;-)

Sorry about that, I just used the defaults that
scripts/get_maintainer.pl offered,
which is often easier than coming up with a smaller distribution list. You are
right this was a lot more than necessary in this case.

> Anyway, I resolved this differently:
> https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git/commit/?h=dm-4.16&id=496cc64f4d10ba112aa0679a3bf29ae6ea74ff3d

Ok, thanks!

      Arnd

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

end of thread, other threads:[~2017-12-11 15:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-11 11:33 [PATCH] dm: fix uninitialized variable reference Arnd Bergmann
2017-12-11 13:50 ` Mike Snitzer
2017-12-11 15:50   ` Arnd Bergmann

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.