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

cache: avoid expression overflow

Cast data_extents to 64bit so calculation is in 64b arithmetic.
This commit is contained in:
Zdenek Kabelac 2014-05-07 11:12:05 +02:00
parent e585a6bbcf
commit 48a8cf28f7
2 changed files with 2 additions and 1 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.107 -
==================================
Use proper uint64 casting for calculation of cache metadata size.
Better support for nesting of blocking signals.
Use only sigaction handler and drop duplicate signal handler.
Separate signal handling and flock code out into lib/misc.

View File

@ -57,7 +57,7 @@ int update_cache_pool_params(struct volume_group *vg, unsigned attr,
* ... plus a good amount of padding (2x) to cover any
* policy hint data that may be added in the future.
*/
min_meta_size = 16 * (data_extents * vg->extent_size);
min_meta_size = (uint64_t)data_extents * vg->extent_size * 16;
min_meta_size /= *chunk_size; /* # of Bytes we need */
min_meta_size *= 2; /* plus some padding */
min_meta_size /= 512; /* in sectors */