From b0e9ba5f4b40f242df41506c09ef8fdd712084db Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Wed, 1 Dec 2010 13:05:06 +0000 Subject: [PATCH] Check str_list_add() success Report error if str_list_add fails. --- WHATS_NEW | 1 + lib/format_pool/import_export.c | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/WHATS_NEW b/WHATS_NEW index 2eda317ba..e4aaba5d2 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.78 - ==================================== + Check str_list_add() success in _add_stripe_seg(). Check lv_info() success in _mirrored_transient_status(). Add backtraces for dev_set() and dev_close_immediate() errors in set_lv(). Add logging for unlink() error in clvmd remove_lockfile(). diff --git a/lib/format_pool/import_export.c b/lib/format_pool/import_export.c index 07f67fd42..788424714 100644 --- a/lib/format_pool/import_export.c +++ b/lib/format_pool/import_export.c @@ -206,7 +206,10 @@ static int _add_stripe_seg(struct dm_pool *mem, return_0; /* add the subpool type to the segment tag list */ - str_list_add(mem, &seg->tags, _cvt_sptype(usp->type)); + if (!str_list_add(mem, &seg->tags, _cvt_sptype(usp->type))) { + log_error("Allocation failed for str_list."); + return 0; + } dm_list_add(&lv->segments, &seg->list); @@ -240,7 +243,10 @@ static int _add_linear_seg(struct dm_pool *mem, } /* add the subpool type to the segment tag list */ - str_list_add(mem, &seg->tags, _cvt_sptype(usp->type)); + if (!str_list_add(mem, &seg->tags, _cvt_sptype(usp->type))) { + log_error("Allocation failed for str_list."); + return 0; + } if (!set_lv_segment_area_pv(seg, 0, usp->devs[j].pv, 0)) return_0; -- 2.43.5