[lvm-devel] master - libdm: abort filemap update if pool allocation fails (coverity)

Bryn Reeves bmr at sourceware.org
Wed Mar 29 20:16:41 UTC 2017


Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f86c1f5d0a38afc9d174e59af4bab83127e4b2b8
Commit:        f86c1f5d0a38afc9d174e59af4bab83127e4b2b8
Parent:        bc5d67884fd489682c0267002474e9089e368fe2
Author:        Bryn M. Reeves <bmr at redhat.com>
AuthorDate:    Wed Mar 29 17:39:31 2017 +0100
Committer:     Bryn M. Reeves <bmr at redhat.com>
CommitterDate: Wed Mar 29 18:34:38 2017 +0100

libdm: abort filemap update if pool allocation fails (coverity)

---
 libdm/libdm-stats.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
index 5041d61..94696fb 100644
--- a/libdm/libdm-stats.c
+++ b/libdm/libdm-stats.c
@@ -4540,8 +4540,9 @@ static int _stats_unmap_regions(struct dm_stats *dms, uint64_t group_id,
 			ext.id = i;
 			nr_kept++;
 
-			dm_pool_grow_object(mem, &ext,
-					    sizeof(ext));
+			if (!dm_pool_grow_object(mem, &ext, sizeof(ext)))
+				goto out;
+
 			log_very_verbose("Kept region " FMTu64, i);
 		} else {
 




More information about the lvm-devel mailing list