diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2015-08-17 18:25:22 +0100 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2015-08-17 18:37:16 +0100 |
commit | 8967776713e1be2d584bc8a9713eaaaf467d8ac7 (patch) | |
tree | 2c2ea3e49b13bb7599012a717a0aba7e56eebb8e | |
parent | d1c65d1b28c8942b4296da30dc95b7e7de33e5fe (diff) | |
download | lvm2-8967776713e1be2d584bc8a9713eaaaf467d8ac7.tar.gz |
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.
-rw-r--r-- | libdm/libdm-stats.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c index f8d0012e2..b7000cc80 100644 --- a/libdm/libdm-stats.c +++ b/libdm/libdm-stats.c @@ -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; } |