1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

libdm: check for mem when _canonicalize_field_ids

Add missing check for dm_pool_strdup() call (Coverity).
This commit is contained in:
Zdenek Kabelac 2016-10-03 16:29:55 +02:00
parent ee04f1fcfd
commit d70f112762
2 changed files with 5 additions and 1 deletions

View File

@ -1,5 +1,6 @@
Version 1.02.136 - Version 1.02.136 -
====================================== ======================================
Check mem alloc fail in _canonicalize_field_ids().
Use unsigned math when checking more then 31 legs of raid. Use unsigned math when checking more then 31 legs of raid.
Fix 'dmstats delete' with dmsetup older than v1.02.129 Fix 'dmstats delete' with dmsetup older than v1.02.129
Fix stats walk segfault with dmsetup older than v1.02.129 Fix stats walk segfault with dmsetup older than v1.02.129

View File

@ -1228,7 +1228,10 @@ static int _canonicalize_field_ids(struct dm_report *rh)
return_0; return_0;
if (differs) { if (differs) {
canonical_field_dup = dm_pool_strdup(rh->mem, canonical_field); if (!(canonical_field_dup = dm_pool_strdup(rh->mem, canonical_field))) {
log_error("_canonicalize_field_dup: dm_pool_alloc failed.");
return 0;
}
rh->canonical_field_ids[i] = canonical_field_dup; rh->canonical_field_ids[i] = canonical_field_dup;
} else } else
rh->canonical_field_ids[i] = rh->fields[i].id; rh->canonical_field_ids[i] = rh->fields[i].id;