summaryrefslogtreecommitdiff
path: root/tools/lvmdevices.c
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2021-04-22 12:31:49 +0200
committerZdenek Kabelac <zkabelac@redhat.com>2021-04-23 23:00:55 +0200
commitbf461b99c6d26e550835b77eaffe2204cbc9bed3 (patch)
tree37a4b14b0af9d0436acfe7ee2fd36a229d5d1321 /tools/lvmdevices.c
parent7e135868374601020920094f135d678c688d0950 (diff)
downloadlvm2-bf461b99c6d26e550835b77eaffe2204cbc9bed3.tar.gz
cov: check label_read_pvid return value
Command can early exit when function returns 0.
Diffstat (limited to 'tools/lvmdevices.c')
-rw-r--r--tools/lvmdevices.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/lvmdevices.c b/tools/lvmdevices.c
index b67db7464..c6cb1fcff 100644
--- a/tools/lvmdevices.c
+++ b/tools/lvmdevices.c
@@ -181,7 +181,8 @@ int lvmdevices(struct cmd_context *cmd, int argc, char **argv)
continue;
dev = du->dev;
- label_read_pvid(dev);
+ if (!label_read_pvid(dev))
+ continue;
/*
* label_read_pvid has read the first 4K of the device
@@ -283,7 +284,8 @@ int lvmdevices(struct cmd_context *cmd, int argc, char **argv)
* (it's ok if the device is not a PV and has no PVID)
*/
label_scan_setup_bcache();
- label_read_pvid(dev);
+ if (!label_read_pvid(dev))
+ goto_bad;
/*
* Allow filtered devices to be added to devices_file, but