1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-10 16:58:47 +03:00

coverity: fix possible integer overflow

LVM2.2.02.112/lib/metadata/cache_manip.c:73: overflow_before_widen: Potentially overflowing expression "*pool_metadata_extents *vg->extent_size" with type "unsigned int" (32 bits, unsigned) is evaluated using 32-bit arithmetic, and then used in a context that expects an expression of type "uint64_t" (64 bits, unsigned).
LVM2.2.02.112/lib/activate/dev_manager.c:217: overflow_before_widen: Potentially overflowing expression "seg_status->seg->len * extent_size" with type "unsigned int" (32 bits, unsigned) is evaluated using 32-bit arithmetic, and then used in a context that expects an expression of type "uint64_t" (64 bits, unsigned).
LVM2.2.02.112/lib/activate/dev_manager.c:217: overflow_before_widen: Potentially overflowing expression "seg_status->seg->le * extent_size" with type "unsigned int" (32 bits, unsigned) is evaluated using 32-bit arithmetic, and then used in a context that expects an expression of type "uint64_t" (64 bits, unsigned).
This commit is contained in:
Peter Rajnoha 2014-11-12 10:03:27 +01:00
parent 60cc666c94
commit ce8730b508
2 changed files with 3 additions and 3 deletions

View File

@ -217,8 +217,8 @@ static int _info_run(info_type_t type, const char *name, const char *dlid,
do {
target = dm_get_next_target(dmt, target, &target_start,
&target_length, &target_name, &target_params);
if ((seg_status->seg->le * extent_size == target_start) &&
(seg_status->seg->len * extent_size == target_length)) {
if (((uint64_t) seg_status->seg->le * extent_size == target_start) &&
((uint64_t) seg_status->seg->len * extent_size == target_length)) {
params_to_process = target_params;
break;
}

View File

@ -70,7 +70,7 @@ int update_cache_pool_params(const struct segment_type *segtype,
{
uint64_t min_meta_size;
uint32_t extent_size = vg->extent_size;
uint64_t pool_metadata_size = *pool_metadata_extents * vg->extent_size;
uint64_t pool_metadata_size = (uint64_t) *pool_metadata_extents * vg->extent_size;
if (!(passed_args & PASS_ARG_CHUNK_SIZE))
*chunk_size = DEFAULT_CACHE_POOL_CHUNK_SIZE * 2;