From d1c6da2f660d2b09b2ae60c9f9ec57d74a142eb2 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Mon, 29 Jul 2024 16:00:27 +0200 Subject: [PATCH] cov: validate altdev list is not empty --- lib/cache/lvmcache.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c index e965903ef..b96ccd58a 100644 --- a/lib/cache/lvmcache.c +++ b/lib/cache/lvmcache.c @@ -1052,6 +1052,8 @@ next: log_debug_cache("PV %s with duplicates unselected using %s.", pvid, dev_name(devl->dev)); goto next; + } else if (dm_list_empty(&altdevs)) { + goto next; } else { devl = dm_list_item(dm_list_first(&altdevs), struct device_list); dev1 = devl->dev;