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

libdm: fix region overlap tests

This commit is contained in:
Bryn M. Reeves 2016-12-12 22:49:31 +00:00
parent 93f420caf4
commit 138e4336fd

View File

@ -3880,6 +3880,12 @@ static int _stats_group_check_overlap(const struct dm_stats *dms,
i++; i++;
} }
/* A single region cannot overlap itself. */
if (i == 1) {
dm_pool_free(dms->mem, map);
return 1;
}
/* sort by extent.start */ /* sort by extent.start */
qsort(map, count, sizeof(*map), _extent_start_compare); qsort(map, count, sizeof(*map), _extent_start_compare);
@ -3915,7 +3921,7 @@ merge:
goto merge; goto merge;
dm_pool_free(dms->mem, map); dm_pool_free(dms->mem, map);
return overlap; return (overlap == 0);
} }
static void _stats_copy_histogram_bounds(struct dm_histogram *to, static void _stats_copy_histogram_bounds(struct dm_histogram *to,