From 2bcbc4d12c9c1be7e6bf59b1acc3c3f5edd7900c Mon Sep 17 00:00:00 2001 From: Anatoly Burakov Date: Tue, 17 Apr 2018 16:44:06 +0100 Subject: [PATCH] fbarray: check for open failure Coverity issue: 272564 Fixes: c44d09811b40 ("eal: add shared indexed file-backed array") Signed-off-by: Anatoly Burakov Acked-by: Adrien Mazarguil --- lib/librte_eal/common/eal_common_fbarray.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/librte_eal/common/eal_common_fbarray.c b/lib/librte_eal/common/eal_common_fbarray.c index d8ebd621c4..2263f4c078 100644 --- a/lib/librte_eal/common/eal_common_fbarray.c +++ b/lib/librte_eal/common/eal_common_fbarray.c @@ -594,6 +594,11 @@ rte_fbarray_destroy(struct rte_fbarray *arr) eal_get_fbarray_path(path, sizeof(path), arr->name); fd = open(path, O_RDONLY); + if (fd < 0) { + RTE_LOG(ERR, EAL, "Could not open fbarray file: %s\n", + strerror(errno)); + return -1; + } if (flock(fd, LOCK_EX | LOCK_NB)) { RTE_LOG(DEBUG, EAL, "Cannot destroy fbarray - another process is using it\n"); rte_errno = EBUSY; -- 2.20.1