]> sourceware.org Git - lvm2.git/commitdiff
cov: check _insert_dev return value
authorZdenek Kabelac <zkabelac@redhat.com>
Thu, 22 Apr 2021 10:30:26 +0000 (12:30 +0200)
committerZdenek Kabelac <zkabelac@redhat.com>
Fri, 23 Apr 2021 21:00:55 +0000 (23:00 +0200)
Although we try later to validate device was inserted,
we can validate return value and early-exit.

lib/device/dev-cache.c

index aa93b575879954f9902a098be28bf1dfe906cade..dddf84e4d407fe035cc1127c52194fa343d7cedf 100644 (file)
@@ -1510,7 +1510,8 @@ struct device *dev_cache_get(struct cmd_context *cmd, const char *name, struct d
         * for st_rdev.
         */
        if (!dev) {
-               _insert_dev(name, st.st_rdev);
+               if (!_insert_dev(name, st.st_rdev))
+                       return_NULL;
 
                /* Get the struct dev that was just added. */
                dev = (struct device *) dm_hash_lookup(_cache.names, name);
This page took 0.041057 seconds and 5 git commands to generate.