DPDK patches and discussions
 help / color / mirror / Atom feed
* Re: [dpdk-dev] [PATCH] eal: fix unchecked return value from library
  2016-04-21 11:56 [dpdk-dev] [PATCH] eal: fix unchecked return value from library Daniel Mrzyglod
@ 2016-04-21 11:06 ` Burakov, Anatoly
  2016-04-21 16:05 ` Stephen Hemminger
  2016-04-22 13:17 ` [dpdk-dev] [PATCH v2] " Daniel Mrzyglod
  2 siblings, 0 replies; 5+ messages in thread
From: Burakov, Anatoly @ 2016-04-21 11:06 UTC (permalink / raw)
  To: Mrzyglod, DanielX T; +Cc: dev

> Fix issue reported by Coverity.
> Coverity ID 13194
> 
> The function returns a value that indicates an error condition. If this  is not
> checked, the error condition may not be handled correctly.
> 
> In pci_vfio_mp_sync_thread: Value returned from a library function is not
> checked for errors before being used. This value may indicate an error
> condition.
> 
> Fixes: 2f4adfad0a69 ("vfio: add multiprocess support")
> 
> Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
> ---
>  lib/librte_eal/linuxapp/eal/eal_pci_vfio_mp_sync.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio_mp_sync.c
> b/lib/librte_eal/linuxapp/eal/eal_pci_vfio_mp_sync.c
> index d9188fd..2b136fc 100644
> --- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio_mp_sync.c
> +++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio_mp_sync.c
> @@ -287,7 +287,10 @@ pci_vfio_mp_sync_thread(void __rte_unused * arg)
>  		struct linger l;
>  		l.l_onoff = 1;
>  		l.l_linger = 60;
> -		setsockopt(conn_sock, SOL_SOCKET, SO_LINGER, &l,
> sizeof(l));
> +
> +		if (setsockopt(conn_sock, SOL_SOCKET, SO_LINGER, &l,
> sizeof(l)) < 0)
> +			RTE_LOG(ERR, EAL, "Cannot set SO_LINGER option "
> +					"on listen socket (%s)\n",
> strerror(errno));
> 
>  		ret = vfio_mp_sync_receive_request(conn_sock);
> 
> --
> 2.5.5

Acked-by: Anatoly  Burakov <anatoly.burakov@intel.com>

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

* [dpdk-dev] [PATCH] eal: fix unchecked return value from library
@ 2016-04-21 11:56 Daniel Mrzyglod
  2016-04-21 11:06 ` Burakov, Anatoly
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Daniel Mrzyglod @ 2016-04-21 11:56 UTC (permalink / raw)
  To: anatoly.burakov; +Cc: dev, Daniel Mrzyglod

Fix issue reported by Coverity.
Coverity ID 13194

The function returns a value that indicates an error condition. If this
 is not checked, the error condition may not be handled correctly.

In pci_vfio_mp_sync_thread: Value returned from a library function is not
checked for errors before being used. This value may indicate an error condition.

Fixes: 2f4adfad0a69 ("vfio: add multiprocess support")

Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
---
 lib/librte_eal/linuxapp/eal/eal_pci_vfio_mp_sync.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio_mp_sync.c b/lib/librte_eal/linuxapp/eal/eal_pci_vfio_mp_sync.c
index d9188fd..2b136fc 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio_mp_sync.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio_mp_sync.c
@@ -287,7 +287,10 @@ pci_vfio_mp_sync_thread(void __rte_unused * arg)
 		struct linger l;
 		l.l_onoff = 1;
 		l.l_linger = 60;
-		setsockopt(conn_sock, SOL_SOCKET, SO_LINGER, &l, sizeof(l));
+
+		if (setsockopt(conn_sock, SOL_SOCKET, SO_LINGER, &l, sizeof(l)) < 0)
+			RTE_LOG(ERR, EAL, "Cannot set SO_LINGER option "
+					"on listen socket (%s)\n", strerror(errno));
 
 		ret = vfio_mp_sync_receive_request(conn_sock);
 
-- 
2.5.5

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

* Re: [dpdk-dev] [PATCH] eal: fix unchecked return value from library
  2016-04-21 11:56 [dpdk-dev] [PATCH] eal: fix unchecked return value from library Daniel Mrzyglod
  2016-04-21 11:06 ` Burakov, Anatoly
@ 2016-04-21 16:05 ` Stephen Hemminger
  2016-04-22 13:17 ` [dpdk-dev] [PATCH v2] " Daniel Mrzyglod
  2 siblings, 0 replies; 5+ messages in thread
From: Stephen Hemminger @ 2016-04-21 16:05 UTC (permalink / raw)
  To: Daniel Mrzyglod; +Cc: anatoly.burakov, dev

On Thu, 21 Apr 2016 13:56:57 +0200
Daniel Mrzyglod <danielx.t.mrzyglod@intel.com> wrote:

> +		if (setsockopt(conn_sock, SOL_SOCKET, SO_LINGER, &l, sizeof(l)) < 0)
> +			RTE_LOG(ERR, EAL, "Cannot set SO_LINGER option "
> +					"on listen socket (%s)\n", strerror(errno));

Priority should be WARNING not ERR because it has no real impact on the application
usability

   level
       This  determines  the  importance  of  the message.  The levels are, in
       order of decreasing importance:

       LOG_EMERG      system is unusable

       LOG_ALERT      action must be taken immediately

       LOG_CRIT       critical conditions

       LOG_ERR        error conditions

       LOG_WARNING    warning conditions

       LOG_NOTICE     normal, but significant, condition

       LOG_INFO       informational message

       LOG_DEBUG      debug-level message

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

* [dpdk-dev] [PATCH v2] eal: fix unchecked return value from library
  2016-04-21 11:56 [dpdk-dev] [PATCH] eal: fix unchecked return value from library Daniel Mrzyglod
  2016-04-21 11:06 ` Burakov, Anatoly
  2016-04-21 16:05 ` Stephen Hemminger
@ 2016-04-22 13:17 ` Daniel Mrzyglod
  2016-04-27 14:03   ` Thomas Monjalon
  2 siblings, 1 reply; 5+ messages in thread
From: Daniel Mrzyglod @ 2016-04-22 13:17 UTC (permalink / raw)
  To: dev; +Cc: Daniel Mrzyglod

Fix issue reported by Coverity.
Coverity ID 13194

The function returns a value that indicates an error condition. If this
 is not checked, the error condition may not be handled correctly.

In pci_vfio_mp_sync_thread: Value returned from a library function is not
checked for errors before being used. This value may indicate an error condition.

Fixes: 2f4adfad0a69 ("vfio: add multiprocess support")

v2:
Changed ERR to WARNING because it has no real impact on the application
usability

Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 lib/librte_eal/linuxapp/eal/eal_pci_vfio_mp_sync.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio_mp_sync.c b/lib/librte_eal/linuxapp/eal/eal_pci_vfio_mp_sync.c
index d9188fd..26d966e 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio_mp_sync.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio_mp_sync.c
@@ -287,7 +287,10 @@ pci_vfio_mp_sync_thread(void __rte_unused * arg)
 		struct linger l;
 		l.l_onoff = 1;
 		l.l_linger = 60;
-		setsockopt(conn_sock, SOL_SOCKET, SO_LINGER, &l, sizeof(l));
+
+		if (setsockopt(conn_sock, SOL_SOCKET, SO_LINGER, &l, sizeof(l)) < 0)
+			RTE_LOG(WARNING, EAL, "Cannot set SO_LINGER option "
+					"on listen socket (%s)\n", strerror(errno));
 
 		ret = vfio_mp_sync_receive_request(conn_sock);
 
-- 
2.5.5

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

* Re: [dpdk-dev] [PATCH v2] eal: fix unchecked return value from library
  2016-04-22 13:17 ` [dpdk-dev] [PATCH v2] " Daniel Mrzyglod
@ 2016-04-27 14:03   ` Thomas Monjalon
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Monjalon @ 2016-04-27 14:03 UTC (permalink / raw)
  To: Daniel Mrzyglod; +Cc: dev

2016-04-22 15:17, Daniel Mrzyglod:
> Fix issue reported by Coverity.
> Coverity ID 13194
> 
> The function returns a value that indicates an error condition. If this
>  is not checked, the error condition may not be handled correctly.
> 
> In pci_vfio_mp_sync_thread: Value returned from a library function is not
> checked for errors before being used. This value may indicate an error condition.
> 
> Fixes: 2f4adfad0a69 ("vfio: add multiprocess support")
> 
> v2:
> Changed ERR to WARNING because it has no real impact on the application
> usability
> 
> Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
> Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>

Applied, thanks

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

end of thread, other threads:[~2016-04-27 14:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-21 11:56 [dpdk-dev] [PATCH] eal: fix unchecked return value from library Daniel Mrzyglod
2016-04-21 11:06 ` Burakov, Anatoly
2016-04-21 16:05 ` Stephen Hemminger
2016-04-22 13:17 ` [dpdk-dev] [PATCH v2] " Daniel Mrzyglod
2016-04-27 14:03   ` Thomas Monjalon

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