1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

cov: check for to_dlm_mode return value

Avoid processing invalid to_dlm_mode in lm_convert_dlm.
This commit is contained in:
Zdenek Kabelac 2024-03-25 14:33:40 +01:00
parent 46e013988f
commit 8716d8c188

View File

@ -637,7 +637,7 @@ int lm_convert_dlm(struct lockspace *ls, struct resource *r,
struct lm_dlm *lmd = (struct lm_dlm *)ls->lm_data; struct lm_dlm *lmd = (struct lm_dlm *)ls->lm_data;
struct rd_dlm *rdd = (struct rd_dlm *)r->lm_data; struct rd_dlm *rdd = (struct rd_dlm *)r->lm_data;
struct dlm_lksb *lksb = &rdd->lksb; struct dlm_lksb *lksb = &rdd->lksb;
uint32_t mode; int mode;
uint32_t flags = 0; uint32_t flags = 0;
int rv; int rv;
@ -661,8 +661,10 @@ int lm_convert_dlm(struct lockspace *ls, struct resource *r,
flags |= LKF_VALBLK; flags |= LKF_VALBLK;
} }
mode = to_dlm_mode(ld_mode); if ((mode = to_dlm_mode(ld_mode)) < 0) {
log_error("lm_convert_dlm invalid mode %d", ld_mode);
return -EINVAL;
}
if (daemon_test) if (daemon_test)
return 0; return 0;