Skip to contentSkip to conversation

net/virtio-user: fix return value check

PATCH Applied Chenbo Xia 5 participants 5 messages Apr 10, 2019 – Apr 17, 2019 Network drivers

lore
Share & tools
lore

Chenbo Xia

author
#0 lore raw

PATCH 1/1 net/virtio-user: fix return value check

Fix unchecked return value for fcntl.

Coverity issue: 277210

Fixes bd8f50a45d0f ("net/virtio-user: support server mode")
---
 drivers/net/virtio/virtio_user/vhost_user.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/virtio/virtio_user/vhost_user.c +4 -1
index 827a48ad6..4b74bd2d8 100644
@@ -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;
 }
Signature · 1 line
2.17.1