Skip to contentSkip to conversation

main - cov: sanitize function environment

PATCH Zdenek Kabelac 1 participant 1 message Sep 21, 2021

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=30e27d2f8b8fbe3031c0e2863a22c77b577019a0
Commit:        30e27d2f8b8fbe3031c0e2863a22c77b577019a0
Parent:        a13dfcbc77bcfdb4bfcff659fde8e11f73225643
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Tue Sep 21 18:46:52 2021 +0200
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Tue Sep 21 21:03:47 2021 +0200

cov: sanitize function environment

Coverity can see that function is either used with 'dev' or 'def'.

---
 tools/pvck.c | 3 +++
 1 file changed, 3 insertions(+)
tools/pvck.c +3 -0
index 0d1bc1b17..b96b1c784 100644
@@ -379,6 +379,9 @@ static bool _read_bytes(struct device *dev, struct devicefile *def, uint64_t sta
 	if (dev)
 		return dev_read_bytes(dev, start, len, data);
 
+	if (!def)
+		return false;
+
 	off = lseek(def->fd, start, SEEK_SET);
 	if (off != start)
 		return false;