main - cov: validate dev_get_primary_dev result
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=7b52a663a6436581cfacd9212929db551a00920f Commit: 7b52a663a6436581cfacd9212929db551a00920f Parent: 0cc5c2203b72e84b12cc93f2f73fb679f3f7ae09 Author: Zdenek Kabelac <[email protected]> AuthorDate: Wed May 10 13:28:38 2023 +0200 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Wed May 10 15:27:48 2023 +0200
cov: validate dev_get_primary_dev result
Make sure primary_dev is defined when using it.
--- lib/device/dev-mpath.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
lib/device/dev-mpath.c +2 -1
@@ -688,7 +688,8 @@ int dev_is_mpath_component(struct cmd_context *cmd, struct device *dev, dev_t *h* primary_result 2: dev is a partition, primary_dev is the whole device * primary_result 1: dev is a whole device */ - primary_result =dev_get_primary_dev (dt, dev, &primary_dev); +if (!(primary_result =dev_get_primary_dev (dt, dev, &primary_dev))) + return_0;if (_dev_is_mpath_component_sysfs (cmd, dev, primary_result, primary_dev, holder_devno) ==1 ) goto found;