[v1] net/virtio-user: fix return value check

Message ID 20190410024405.14982-1-chenbo.xia@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Maxime Coquelin
Headers
Series [v1] net/virtio-user: fix return value check |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/intel-Performance-Testing success Performance Testing PASS
ci/mellanox-Performance-Testing success Performance Testing PASS

Commit Message

Chenbo Xia April 10, 2019, 2:44 a.m. UTC
  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(-)
  

Comments

Rami Rosen April 10, 2019, 4:37 a.m. UTC | #1
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>
---

Acked-by: Rami Rosen <ramirose@gmail.com>
  
Jens Freimann April 10, 2019, 3:18 p.m. UTC | #2
On Wed, Apr 10, 2019 at 02:44:05AM +0000, Chenbo Xia wrote:
>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(-)
>

Reviewed-by: Jens Freimann <jfreimann@redhat.com>
  
Tiwei Bie April 12, 2019, 4:16 a.m. UTC | #3
On Wed, Apr 10, 2019 at 02:44:05AM +0000, Chenbo Xia wrote:
> 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(-)

Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
  
Maxime Coquelin April 17, 2019, 7:56 a.m. UTC | #4
On 4/10/19 4:44 AM, Chenbo Xia wrote:
> 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(-)


Applied to dpdk-next-virtio/master.

Thanks,
Maxime
  

Patch

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;
 }