DPDK patches and discussions
 help / color / mirror / Atom feed
From: Chenbo Xia <chenbo.xia@intel.com>
To: dev@dpdk.org
Cc: maxime.coquelin@redhat.com, tiwei.bie@intel.com,
	zhihong.wang@intel.com, stable@dpdk.org
Subject: [dpdk-dev] [PATCH v1] net/virtio-user: fix return value check
Date: Wed, 10 Apr 2019 02:44:05 +0000
Message-ID: <20190410024405.14982-1-chenbo.xia@intel.com> (raw)
Message-ID: <20190410024405.exv9Mv54aTZEuNeVNJbiGUl12pWOcTtV7gT9JxVyaXE@z> (raw)

Fix unchecked return value for fcntl.

Coverity issue: 277210
Fixes: bd8f50a45d0f ("net/virtio-user: support server mode")
Cc: stable@dpdk.org

Signed-off-by: Chenbo Xia <chenbo.xia@intel.com>
---
 drivers/net/virtio/virtio_user/vhost_user.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/virtio/virtio_user/vhost_user.c b/drivers/net/virtio/virtio_user/vhost_user.c
index 827a48ad6..4b74bd2d8 100644
--- a/drivers/net/virtio/virtio_user/vhost_user.c
+++ b/drivers/net/virtio/virtio_user/vhost_user.c
@@ -394,7 +394,10 @@ virtio_user_start_server(struct virtio_user_dev *dev, struct sockaddr_un *un)
 		return -1;
 
 	flag = fcntl(fd, F_GETFL);
-	fcntl(fd, F_SETFL, flag | O_NONBLOCK);
+	if (fcntl(fd, F_SETFL, flag | O_NONBLOCK) < 0) {
+		PMD_DRV_LOG(ERR, "fcntl failed, %s", strerror(errno));
+		return -1;
+	}
 
 	return 0;
 }
-- 
2.17.1


             reply	other threads:[~2019-04-10  3:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-10  2:44 Chenbo Xia [this message]
2019-04-10  2:44 ` Chenbo Xia
2019-04-10  4:37 ` Rami Rosen
2019-04-10  4:37   ` Rami Rosen
2019-04-10 15:18 ` Jens Freimann
2019-04-10 15:18   ` Jens Freimann
2019-04-12  4:16 ` Tiwei Bie
2019-04-12  4:16   ` Tiwei Bie
2019-04-17  7:56 ` Maxime Coquelin
2019-04-17  7:56   ` Maxime Coquelin
2020-07-29 13:12 Chenbo Xia
2020-07-29 14:22 ` Maxime Coquelin
2020-07-29 14:54 ` Maxime Coquelin

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=20190410024405.14982-1-chenbo.xia@intel.com \
    --to=chenbo.xia@intel.com \
    --cc=dev@dpdk.org \
    --cc=maxime.coquelin@redhat.com \
    --cc=stable@dpdk.org \
    --cc=tiwei.bie@intel.com \
    --cc=zhihong.wang@intel.com \
    /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

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git