Avoid returning uninitialized value in case
lookup fails.

Signed-off-by: Tomas Melin <tomas.me...@vaisala.com>
---
 drivers/md/dm-table.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 8fc44c9f746a..71c59455bf3b 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -331,7 +331,7 @@ static int upgrade_mode(struct dm_dev_internal *dd, fmode_t 
new_mode,
  */
 dev_t dm_get_dev_t(const char *path)
 {
-       dev_t dev;
+       dev_t dev = 0;
 
        if (lookup_bdev(path, &dev))
                dev = name_to_dev_t(path);
-- 
2.35.1

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel

Reply via email to