diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2019-06-25 15:21:46 +0200 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2019-06-25 17:33:47 +0200 |
commit | 7232458b6c114cc83b471f08abc49fd1673831c4 (patch) | |
tree | ea207d0c6d3595bbb8656565ae5d52ad648b50ad | |
parent | 8bea252a636ff0de2266c1ce760b3a6047f0ff2f (diff) | |
download | lvm2-7232458b6c114cc83b471f08abc49fd1673831c4.tar.gz |
cov: validate pagesize is not negative
As _init_free_list() cannot accept negative numbers
-rw-r--r-- | lib/device/bcache.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/device/bcache.c b/lib/device/bcache.c index dac8be64d..ccf0046ba 100644 --- a/lib/device/bcache.c +++ b/lib/device/bcache.c @@ -1040,6 +1040,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 = sysconf(_SC_PAGESIZE)) < 0) { + log_warn("bcache cannot read pagesize."); + return NULL; + } + if (!nr_cache_blocks) { log_warn("bcache must have at least one cache block"); return NULL; |