All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][next] dm writecache: fix missing goto in error handling code
@ 2018-05-27 22:25 ` Colin King
  0 siblings, 0 replies; 4+ messages in thread
From: Colin King @ 2018-05-27 22:25 UTC (permalink / raw)
  To: Alasdair Kergon, Mike Snitzer, dm-devel; +Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Currently, the -EFBIG error condition when n_bitmaps_bits is
too large is falling through to the next statement and the
error assignment to r is potentially being ignored.  The code
should be exiting to the error path via label 'bad'. Fix
this by adding the missing goto statement.

Detected by CoverityScan, CID#1469377 ("Unused value")

Fixes: bb15b431d650 ("dm: add writecache target")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/md/dm-writecache.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c
index 1ef06e738eb6..e61704b6eae1 100644
--- a/drivers/md/dm-writecache.c
+++ b/drivers/md/dm-writecache.c
@@ -2077,6 +2077,7 @@ static int writecache_ctr(struct dm_target *ti, unsigned argc, char **argv)
 		if (n_bitmap_bits > 1U << 31) {
 			r = -EFBIG;
 			ti->error = "Invalid device size";
+			goto bad;
 		}
 
 		wc->memory_map = vmalloc(n_metadata_blocks << wc->block_size_bits);
-- 
2.17.0

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

* [PATCH][next] dm writecache: fix missing goto in error handling code
@ 2018-05-27 22:25 ` Colin King
  0 siblings, 0 replies; 4+ messages in thread
From: Colin King @ 2018-05-27 22:25 UTC (permalink / raw)
  To: Alasdair Kergon, Mike Snitzer, dm-devel; +Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Currently, the -EFBIG error condition when n_bitmaps_bits is
too large is falling through to the next statement and the
error assignment to r is potentially being ignored.  The code
should be exiting to the error path via label 'bad'. Fix
this by adding the missing goto statement.

Detected by CoverityScan, CID#1469377 ("Unused value")

Fixes: bb15b431d650 ("dm: add writecache target")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/md/dm-writecache.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c
index 1ef06e738eb6..e61704b6eae1 100644
--- a/drivers/md/dm-writecache.c
+++ b/drivers/md/dm-writecache.c
@@ -2077,6 +2077,7 @@ static int writecache_ctr(struct dm_target *ti, unsigned argc, char **argv)
 		if (n_bitmap_bits > 1U << 31) {
 			r = -EFBIG;
 			ti->error = "Invalid device size";
+			goto bad;
 		}
 
 		wc->memory_map = vmalloc(n_metadata_blocks << wc->block_size_bits);
-- 
2.17.0


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

* Re: [PATCH][next] dm writecache: fix missing goto in error handling code
  2018-05-27 22:25 ` Colin King
@ 2018-05-29 18:09   ` Mike Snitzer
  -1 siblings, 0 replies; 4+ messages in thread
From: Mike Snitzer @ 2018-05-29 18:09 UTC (permalink / raw)
  To: Colin King; +Cc: Alasdair Kergon, dm-devel, kernel-janitors, linux-kernel

On Sun, May 27 2018 at  6:25pm -0400,
Colin King <colin.king@canonical.com> wrote:

> From: Colin Ian King <colin.king@canonical.com>
> 
> Currently, the -EFBIG error condition when n_bitmaps_bits is
> too large is falling through to the next statement and the
> error assignment to r is potentially being ignored.  The code
> should be exiting to the error path via label 'bad'. Fix
> this by adding the missing goto statement.
> 
> Detected by CoverityScan, CID#1469377 ("Unused value")
> 
> Fixes: bb15b431d650 ("dm: add writecache target")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Thanks, I've picked this up.

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

* Re: [PATCH][next] dm writecache: fix missing goto in error handling code
@ 2018-05-29 18:09   ` Mike Snitzer
  0 siblings, 0 replies; 4+ messages in thread
From: Mike Snitzer @ 2018-05-29 18:09 UTC (permalink / raw)
  To: Colin King; +Cc: Alasdair Kergon, dm-devel, kernel-janitors, linux-kernel

On Sun, May 27 2018 at  6:25pm -0400,
Colin King <colin.king@canonical.com> wrote:

> From: Colin Ian King <colin.king@canonical.com>
> 
> Currently, the -EFBIG error condition when n_bitmaps_bits is
> too large is falling through to the next statement and the
> error assignment to r is potentially being ignored.  The code
> should be exiting to the error path via label 'bad'. Fix
> this by adding the missing goto statement.
> 
> Detected by CoverityScan, CID#1469377 ("Unused value")
> 
> Fixes: bb15b431d650 ("dm: add writecache target")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Thanks, I've picked this up.

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

end of thread, other threads:[~2018-05-29 18:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-27 22:25 [PATCH][next] dm writecache: fix missing goto in error handling code Colin King
2018-05-27 22:25 ` Colin King
2018-05-29 18:09 ` Mike Snitzer
2018-05-29 18:09   ` Mike Snitzer

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.