Skip to contentSkip to conversation

stable-2.02 - cov: check result of dev_get_block_size

PATCH Zdenek Kabelac 1 participant 1 message Jun 25, 2019

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=82e7426028a90fff891e0b3fafa15826758e18e8
Commit:        82e7426028a90fff891e0b3fafa15826758e18e8
Parent:        862899cc88e1697211d478de58b2ddc0eaec9cd9
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Tue Jun 25 14:56:07 2019 +0200
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Tue Jun 25 17:32:44 2019 +0200

cov: check result of dev_get_block_size

---
 lib/label/label.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
lib/label/label.c +4 -1
index 9a3f8df..6d8156e 100644
@@ -1498,7 +1498,10 @@ void dev_set_last_byte(struct device *dev, uint64_t offset)
 	unsigned int phys_block_size = 0;
 	unsigned int block_size = 0;
 
-	dev_get_block_size(dev, &phys_block_size, &block_size);
+	if (!dev_get_block_size(dev, &phys_block_size, &block_size)) {
+		stack;
+		return; /* FIXME: error path ? */
+	}
 
 	bcache_set_last_byte(scan_bcache, dev->bcache_fd, offset, phys_block_size);
 }