diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2014-09-12 11:48:51 +0200 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2014-09-12 13:45:50 +0200 |
commit | 40b7b107b186e1680db05dcb05230b978852d010 (patch) | |
tree | 79576066bea951cddddfe49d821734faada856f3 | |
parent | 08bde75093665001e7b30a7491c5bb9a53383d56 (diff) | |
download | lvm2-40b7b107b186e1680db05dcb05230b978852d010.tar.gz |
raid: check result of get_segtype_from_string
Error here is rather highly unpexpected for these types, but
stay consistent with rest of the code and don't use unchecked value.
-rw-r--r-- | lib/metadata/raid_manip.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c index 4bfe9c9cc..b7ba464de 100644 --- a/lib/metadata/raid_manip.c +++ b/lib/metadata/raid_manip.c @@ -362,7 +362,9 @@ static int _alloc_image_component(struct logical_volume *lv, return 0; } - segtype = get_segtype_from_string(lv->vg->cmd, "striped"); + if (!(segtype = get_segtype_from_string(lv->vg->cmd, "striped"))) + return_0; + if (!lv_add_segment(ah, first_area, 1, tmp_lv, segtype, 0, status, 0)) { log_error("Failed to add segment to LV, %s", img_name); return 0; @@ -833,7 +835,8 @@ static int _raid_extract_images(struct logical_volume *lv, uint32_t new_count, if (!lvl_array) return_0; - error_segtype = get_segtype_from_string(lv->vg->cmd, "error"); + if (!(error_segtype = get_segtype_from_string(lv->vg->cmd, "error"))) + return_0; /* * We make two passes over the devices. |