patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH v2] Report an error message if the flag O_NONBLOCK setting fails, then return from function.
       [not found] ` <1508821844-37372-1-git-send-email-sebastianx.basierski@intel.com>
@ 2017-10-24  5:10   ` SebastianX Basierski
  2017-10-24  7:26     ` Tan, Jianfeng
                       ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: SebastianX Basierski @ 2017-10-24  5:10 UTC (permalink / raw)
  To: yliu; +Cc: dev, SebastianX Basierski, jianfeng.tan, stable

Coverity issue: 143439

Fixes: ef53b6030039 ("net/virtio-user: support LSC")
Cc: jianfeng.tan@intel.com
cc: stable@dpdk.org

Signed-off-by: SebastianX Basierski <sebastianx.basierski@intel.com>
---
 drivers/net/virtio/virtio_user_ethdev.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index 57c964d..fe3a7be 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -86,7 +86,11 @@ virtio_user_read_dev_config(struct virtio_hw *hw, size_t offset,
 			int flags;
 
 			flags = fcntl(dev->vhostfd, F_GETFL);
-			fcntl(dev->vhostfd, F_SETFL, flags | O_NONBLOCK);
+			if (fcntl(dev->vhostfd, F_SETFL,
+					flags | O_NONBLOCK) == -1){
+				PMD_DRV_LOG(ERR, "error setting O_NONBLOCK flag");
+				return;
+			}
 			r = recv(dev->vhostfd, buf, 128, MSG_PEEK);
 			if (r == 0 || (r < 0 && errno != EAGAIN)) {
 				dev->status &= (~VIRTIO_NET_S_LINK_UP);
-- 
2.7.4

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-stable] [PATCH v2] Report an error message if the flag O_NONBLOCK setting fails, then return from function.
  2017-10-24  5:10   ` [dpdk-stable] [PATCH v2] Report an error message if the flag O_NONBLOCK setting fails, then return from function SebastianX Basierski
@ 2017-10-24  7:26     ` Tan, Jianfeng
  2017-10-24  8:17     ` [dpdk-stable] [PATCH v3] net/virtio: fix unchecked return value SebastianX Basierski
  2017-10-24  8:20     ` SebastianX Basierski
  2 siblings, 0 replies; 5+ messages in thread
From: Tan, Jianfeng @ 2017-10-24  7:26 UTC (permalink / raw)
  To: Basierski, SebastianX, yliu; +Cc: dev, stable



> -----Original Message-----
> From: Basierski, SebastianX
> Sent: Tuesday, October 24, 2017 1:11 PM
> To: yliu@fridaylinux.org
> Cc: dev@dpdk.org; Basierski, SebastianX; Tan, Jianfeng; stable@dpdk.org
> Subject: [PATCH v2] Report an error message if the flag O_NONBLOCK
> setting fails, then return from function.
> 
> Coverity issue: 143439
> 
> Fixes: ef53b6030039 ("net/virtio-user: support LSC")
> Cc: jianfeng.tan@intel.com
> cc: stable@dpdk.org
> 
> Signed-off-by: SebastianX Basierski <sebastianx.basierski@intel.com>

Except a nit below,
Acked-by: Jianfeng Tan <jianfeng.tan@intel.com>


> ---
>  drivers/net/virtio/virtio_user_ethdev.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/virtio/virtio_user_ethdev.c
> b/drivers/net/virtio/virtio_user_ethdev.c
> index 57c964d..fe3a7be 100644
> --- a/drivers/net/virtio/virtio_user_ethdev.c
> +++ b/drivers/net/virtio/virtio_user_ethdev.c
> @@ -86,7 +86,11 @@ virtio_user_read_dev_config(struct virtio_hw *hw,
> size_t offset,
>  			int flags;
> 
>  			flags = fcntl(dev->vhostfd, F_GETFL);
> -			fcntl(dev->vhostfd, F_SETFL, flags | O_NONBLOCK);
> +			if (fcntl(dev->vhostfd, F_SETFL,
> +					flags | O_NONBLOCK) == -1){

There should be a space between ")" and "{".


> +				PMD_DRV_LOG(ERR, "error setting
> O_NONBLOCK flag");
> +				return;
> +			}
>  			r = recv(dev->vhostfd, buf, 128, MSG_PEEK);
>  			if (r == 0 || (r < 0 && errno != EAGAIN)) {
>  				dev->status &= (~VIRTIO_NET_S_LINK_UP);
> --
> 2.7.4

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-stable] [PATCH v3] net/virtio: fix unchecked return value
  2017-10-24  5:10   ` [dpdk-stable] [PATCH v2] Report an error message if the flag O_NONBLOCK setting fails, then return from function SebastianX Basierski
  2017-10-24  7:26     ` Tan, Jianfeng
@ 2017-10-24  8:17     ` SebastianX Basierski
  2017-10-24  8:40       ` Yuanhan Liu
  2017-10-24  8:20     ` SebastianX Basierski
  2 siblings, 1 reply; 5+ messages in thread
From: SebastianX Basierski @ 2017-10-24  8:17 UTC (permalink / raw)
  To: yliu; +Cc: dev, SebastianX Basierski, jianfeng.tan, stable

Report an error message if the flag O_NONBLOCK setting fails,
then return from function.

Coverity issue: 143439

Fixes: ef53b6030039 ("net/virtio-user: support LSC")
Cc: jianfeng.tan@intel.com
cc: stable@dpdk.org

Signed-off-by: SebastianX Basierski <sebastianx.basierski@intel.com>
Acked-by: Jianfeng Tan <jianfeng.tan@intel.com>
---
 drivers/net/virtio/virtio_user_ethdev.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index 57c964d..20b7292 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -86,7 +86,11 @@ virtio_user_read_dev_config(struct virtio_hw *hw, size_t offset,
 			int flags;
 
 			flags = fcntl(dev->vhostfd, F_GETFL);
-			fcntl(dev->vhostfd, F_SETFL, flags | O_NONBLOCK);
+			if (fcntl(dev->vhostfd, F_SETFL,
+					flags | O_NONBLOCK) == -1) {
+				PMD_DRV_LOG(ERR, "error setting O_NONBLOCK flag");
+				return;
+			}
 			r = recv(dev->vhostfd, buf, 128, MSG_PEEK);
 			if (r == 0 || (r < 0 && errno != EAGAIN)) {
 				dev->status &= (~VIRTIO_NET_S_LINK_UP);
-- 
2.7.4

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-stable] [PATCH v3] net/virtio: fix unchecked return value
  2017-10-24  5:10   ` [dpdk-stable] [PATCH v2] Report an error message if the flag O_NONBLOCK setting fails, then return from function SebastianX Basierski
  2017-10-24  7:26     ` Tan, Jianfeng
  2017-10-24  8:17     ` [dpdk-stable] [PATCH v3] net/virtio: fix unchecked return value SebastianX Basierski
@ 2017-10-24  8:20     ` SebastianX Basierski
  2 siblings, 0 replies; 5+ messages in thread
From: SebastianX Basierski @ 2017-10-24  8:20 UTC (permalink / raw)
  To: yliu; +Cc: dev, SebastianX Basierski, jianfeng.tan, stable

Report an error message if the flag O_NONBLOCK setting fails,
then return from function.

Coverity issue: 143439

Fixes: ef53b6030039 ("net/virtio-user: support LSC")
Cc: jianfeng.tan@intel.com
cc: stable@dpdk.org

Signed-off-by: SebastianX Basierski <sebastianx.basierski@intel.com>
Acked-by: Jianfeng Tan <jianfeng.tan@intel.com>
---
 drivers/net/virtio/virtio_user_ethdev.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index 57c964d..20b7292 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -86,7 +86,11 @@ virtio_user_read_dev_config(struct virtio_hw *hw, size_t offset,
 			int flags;
 
 			flags = fcntl(dev->vhostfd, F_GETFL);
-			fcntl(dev->vhostfd, F_SETFL, flags | O_NONBLOCK);
+			if (fcntl(dev->vhostfd, F_SETFL,
+					flags | O_NONBLOCK) == -1) {
+				PMD_DRV_LOG(ERR, "error setting O_NONBLOCK flag");
+				return;
+			}
 			r = recv(dev->vhostfd, buf, 128, MSG_PEEK);
 			if (r == 0 || (r < 0 && errno != EAGAIN)) {
 				dev->status &= (~VIRTIO_NET_S_LINK_UP);
-- 
2.7.4

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-stable] [PATCH v3] net/virtio: fix unchecked return value
  2017-10-24  8:17     ` [dpdk-stable] [PATCH v3] net/virtio: fix unchecked return value SebastianX Basierski
@ 2017-10-24  8:40       ` Yuanhan Liu
  0 siblings, 0 replies; 5+ messages in thread
From: Yuanhan Liu @ 2017-10-24  8:40 UTC (permalink / raw)
  To: SebastianX Basierski; +Cc: dev, jianfeng.tan, stable

On Tue, Oct 24, 2017 at 10:17:38AM +0200, SebastianX Basierski wrote:
> Report an error message if the flag O_NONBLOCK setting fails,
> then return from function.
> 
> Coverity issue: 143439
> 
> Fixes: ef53b6030039 ("net/virtio-user: support LSC")
> Cc: jianfeng.tan@intel.com
> cc: stable@dpdk.org
> 
> Signed-off-by: SebastianX Basierski <sebastianx.basierski@intel.com>
> Acked-by: Jianfeng Tan <jianfeng.tan@intel.com>

Applied to dpdk-next-virtio.

Thanks.

	--yliu

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-10-24  8:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1505821646-33594-1-git-send-email-sebastianx.basierski@intel.com>
     [not found] ` <1508821844-37372-1-git-send-email-sebastianx.basierski@intel.com>
2017-10-24  5:10   ` [dpdk-stable] [PATCH v2] Report an error message if the flag O_NONBLOCK setting fails, then return from function SebastianX Basierski
2017-10-24  7:26     ` Tan, Jianfeng
2017-10-24  8:17     ` [dpdk-stable] [PATCH v3] net/virtio: fix unchecked return value SebastianX Basierski
2017-10-24  8:40       ` Yuanhan Liu
2017-10-24  8:20     ` SebastianX Basierski

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).