]> sourceware.org Git - lvm2.git/commitdiff
cov: check label_read_pvid return value
authorZdenek Kabelac <zkabelac@redhat.com>
Thu, 22 Apr 2021 10:31:49 +0000 (12:31 +0200)
committerZdenek Kabelac <zkabelac@redhat.com>
Fri, 23 Apr 2021 21:00:55 +0000 (23:00 +0200)
Command can early exit when function returns 0.

tools/lvmdevices.c

index b67db7464e37eb1dc114fc8c6b7eaba8054f6f70..c6cb1fcffa8b1a82cdf7a1ad3c893c00adeec9aa 100644 (file)
@@ -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
This page took 0.041213 seconds and 5 git commands to generate.