1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-28 03:27:58 +03:00

libdm: do not read region before checking dms for NULL (Coverity)

dm_stats_get_area_start() attempts to assign a region pointer from
a stats handle before checking it is non-NULL: move the assignment
after the test.
This commit is contained in:
Bryn M. Reeves 2015-08-17 18:25:22 +01:00
parent d1c65d1b28
commit 8967776713

View File

@ -1328,9 +1328,10 @@ int dm_stats_get_current_region_area_len(const struct dm_stats *dms,
int dm_stats_get_area_start(const struct dm_stats *dms, uint64_t *start,
uint64_t region_id, uint64_t area_id)
{
struct dm_stats_region *region = &dms->regions[region_id];
struct dm_stats_region *region;
if (!dms || !dms->regions)
return_0;
region = &dms->regions[region_id];
*start = region->start + region->step * area_id;
return 1;
}