31 lines
945 B
Diff
31 lines
945 B
Diff
From 0049b42891ac6e095b91643320743a3c0a3ae882 Mon Sep 17 00:00:00 2001
|
|
From: root <root@localhost.localdomain>
|
|
Date: Wed, 13 Mar 2019 19:47:31 +0800
|
|
Subject: [PATCH 06/19] 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.
|
|
---
|
|
lib/device/bcache.c | 5 +++++
|
|
1 file changed, 5 insertions(+)
|
|
|
|
diff --git a/lib/device/bcache.c b/lib/device/bcache.c
|
|
index 7384a32..0fc7364 100644
|
|
--- a/lib/device/bcache.c
|
|
+++ b/lib/device/bcache.c
|
|
@@ -1039,6 +1039,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;
|
|
--
|
|
2.19.1
|
|
|