From: Anatoly Burakov Date: Tue, 17 Apr 2018 15:44:08 +0000 (+0100) Subject: fbarray: check sysconf failure X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=7508be4ccead7f092695d5534ab50b3b824baaad;p=dpdk.git fbarray: check sysconf failure sysconf() may return a negative value, check for it. Coverity issue: 272586 Fixes: c44d09811b40 ("eal: add shared indexed file-backed array") Signed-off-by: Anatoly Burakov Acked-by: Adrien Mazarguil --- diff --git a/lib/librte_eal/common/eal_common_fbarray.c b/lib/librte_eal/common/eal_common_fbarray.c index d17611b57f..019f84c186 100644 --- a/lib/librte_eal/common/eal_common_fbarray.c +++ b/lib/librte_eal/common/eal_common_fbarray.c @@ -572,6 +572,9 @@ rte_fbarray_detach(struct rte_fbarray *arr) size_t page_sz = sysconf(_SC_PAGESIZE); + if (page_sz == (size_t)-1) + return -1; + /* this may already be unmapped (e.g. repeated call from previously * failed destroy(), but this is on user, we can't (easily) know if this * is still mapped.