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

cov: add check for positive value

As pgsize parameter for _init_free_list() can't be negative,
report problem in case for any reason we would get negative number.
This commit is contained in:
Zdenek Kabelac 2018-10-15 15:02:09 +02:00
parent 9b71212262
commit eb566e034f

View File

@ -881,6 +881,11 @@ struct bcache *bcache_create(sector_t block_sectors, unsigned nr_cache_blocks,
unsigned max_io = engine->max_io(engine);
long pgsize = sysconf(_SC_PAGESIZE);
if (pgsize < 0) {
log_warn("WARNING: _SC_PAGESIZE returns negative value.");
return NULL;
}
if (!nr_cache_blocks) {
log_warn("bcache must have at least one cache block");
return NULL;