DPDK patches and discussions
 help / color / mirror / Atom feed
From: Anatoly Burakov <anatoly.burakov@intel.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, anatoly.burakov@intel.com
Subject: [dpdk-dev] [PATCH 2/4] fbarray: add check for failed file descriptor open
Date: Tue, 17 Apr 2018 16:44:06 +0100	[thread overview]
Message-ID: <bd98a03f4327f93215e0e67fc8538c1cee883edb.1523978190.git.anatoly.burakov@intel.com> (raw)
In-Reply-To: <cover.1523978190.git.anatoly.burakov@intel.com>
In-Reply-To: <cover.1523978190.git.anatoly.burakov@intel.com>

Coverity issue: 272564

Fixes: c44d09811b40 ("eal: add shared indexed file-backed array")
Cc: anatoly.burakov@intel.com

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 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 8aa9013..95a7c8e 100644
--- a/lib/librte_eal/common/eal_common_fbarray.c
+++ b/lib/librte_eal/common/eal_common_fbarray.c
@@ -583,6 +583,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.7.4

  parent reply	other threads:[~2018-04-17 15:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-17 15:44 [dpdk-dev] [PATCH 0/4] Fixes for coverity issues in fbarray Anatoly Burakov
2018-04-17 15:44 ` [dpdk-dev] [PATCH 1/4] fbarray: use strlcpy instead of snprintf Anatoly Burakov
2018-04-17 15:44 ` Anatoly Burakov [this message]
2018-04-17 15:44 ` [dpdk-dev] [PATCH 3/4] fbarray: fix potential null-dereference Anatoly Burakov
2018-04-17 15:44 ` [dpdk-dev] [PATCH 4/4] fbarray: handle negative return Anatoly Burakov
2018-04-18  8:51 ` [dpdk-dev] [PATCH 0/4] Fixes for coverity issues in fbarray Adrien Mazarguil
2018-04-23 20:16   ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bd98a03f4327f93215e0e67fc8538c1cee883edb.1523978190.git.anatoly.burakov@intel.com \
    --to=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).