[dpdk-dev] [PATCH 4/4] fbarray: handle negative return
Anatoly Burakov
anatoly.burakov at intel.com
Tue Apr 17 17:44:08 CEST 2018
sysconf() may return a negative value, check for it.
Coverity issue: 272586
Fixes: c44d09811b40 ("eal: add shared indexed file-backed array")
Cc: anatoly.burakov at intel.com
Signed-off-by: Anatoly Burakov <anatoly.burakov at intel.com>
---
lib/librte_eal/common/eal_common_fbarray.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lib/librte_eal/common/eal_common_fbarray.c b/lib/librte_eal/common/eal_common_fbarray.c
index c4ed97e..6486679 100644
--- a/lib/librte_eal/common/eal_common_fbarray.c
+++ b/lib/librte_eal/common/eal_common_fbarray.c
@@ -561,6 +561,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.
--
2.7.4
More information about the dev
mailing list