[PATCH][next] dm writecache: fix missing goto in error handling code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Colin Ian King <colin.king@xxxxxxxxxxxxx>

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

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux