mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
Add default error path for get_property
Set invalid property value for error path when NULL handler is passed. Fixes use of uninitialized prop structure as we return 'v' by value. ---
This commit is contained in:
parent
349da06cfa
commit
12fbaae042
@ -1,5 +1,6 @@
|
|||||||
Version 2.02.80 -
|
Version 2.02.80 -
|
||||||
====================================
|
====================================
|
||||||
|
Detect NULL handle in get_property().
|
||||||
Fix superfluous /usr in ocf_scriptdir instalation path.
|
Fix superfluous /usr in ocf_scriptdir instalation path.
|
||||||
Add --with-ocfdir configurable option.
|
Add --with-ocfdir configurable option.
|
||||||
Add aclocal.m4 (for pkgconfig).
|
Add aclocal.m4 (for pkgconfig).
|
||||||
|
@ -52,33 +52,29 @@ struct lvm_property_value get_property(const pv_t pv, const vg_t vg,
|
|||||||
struct lvm_property_type prop;
|
struct lvm_property_type prop;
|
||||||
struct lvm_property_value v;
|
struct lvm_property_value v;
|
||||||
|
|
||||||
|
memset(&v, 0, sizeof(v));
|
||||||
prop.id = name;
|
prop.id = name;
|
||||||
|
|
||||||
if (pv) {
|
if (pv) {
|
||||||
if (!pv_get_property(pv, &prop)) {
|
if (!pv_get_property(pv, &prop))
|
||||||
v.is_valid = 0;
|
|
||||||
return v;
|
return v;
|
||||||
}
|
|
||||||
} else if (vg) {
|
} else if (vg) {
|
||||||
if (!vg_get_property(vg, &prop)) {
|
if (!vg_get_property(vg, &prop))
|
||||||
v.is_valid = 0;
|
|
||||||
return v;
|
return v;
|
||||||
}
|
|
||||||
} else if (lv) {
|
} else if (lv) {
|
||||||
if (!lv_get_property(lv, &prop)) {
|
if (!lv_get_property(lv, &prop))
|
||||||
v.is_valid = 0;
|
|
||||||
return v;
|
return v;
|
||||||
}
|
|
||||||
} else if (lvseg) {
|
} else if (lvseg) {
|
||||||
if (!lvseg_get_property(lvseg, &prop)) {
|
if (!lvseg_get_property(lvseg, &prop))
|
||||||
v.is_valid = 0;
|
|
||||||
return v;
|
return v;
|
||||||
}
|
|
||||||
} else if (pvseg) {
|
} else if (pvseg) {
|
||||||
if (!pvseg_get_property(pvseg, &prop)) {
|
if (!pvseg_get_property(pvseg, &prop))
|
||||||
v.is_valid = 0;
|
return v;
|
||||||
|
} else {
|
||||||
|
log_errno(EINVAL, "Invalid NULL handle passed to library function.");
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
v.is_settable = prop.is_settable;
|
v.is_settable = prop.is_settable;
|
||||||
v.is_string = prop.is_string;
|
v.is_string = prop.is_string;
|
||||||
v.is_integer = prop.is_integer;
|
v.is_integer = prop.is_integer;
|
||||||
|
Loading…
Reference in New Issue
Block a user