DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] examples/netmap_compat: fix infinite loop
@ 2016-04-22 10:47 Michal Kobylinski
  2016-04-22 11:51 ` Mcnamara, John
  2016-04-27 13:22 ` [dpdk-dev] [PATCH v2] " Michal Kobylinski
  0 siblings, 2 replies; 4+ messages in thread
From: Michal Kobylinski @ 2016-04-22 10:47 UTC (permalink / raw)
  To: bruce.richardson, dev; +Cc: Michal Kobylinski

Fix issue reported by Coverity.

Coverity ID 30701: Infinite loop: The loop does not have a normal
termination condition, so will continue until an abnormal condition
arises. In rte_netmap_poll: Infinite loop with unsatisfiable exit
condition.

Fixes: 06371afe394d ("examples/netmap_compat: import netmap compatibility example")

Signed-off-by: Michal Kobylinski <michalx.kobylinski@intel.com>
---
 examples/netmap_compat/lib/compat_netmap.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/examples/netmap_compat/lib/compat_netmap.c b/examples/netmap_compat/lib/compat_netmap.c
index bf1b418..8cb5764 100644
--- a/examples/netmap_compat/lib/compat_netmap.c
+++ b/examples/netmap_compat/lib/compat_netmap.c
@@ -865,6 +865,11 @@ rte_netmap_poll(struct pollfd *fds, nfds_t nfds, int timeout)
 	uint32_t i, idx, port;
 	uint32_t want_rx, want_tx;
 
+	if (timeout > 0) {
+		ret = -1;
+		return ret;
+	}
+
 	ret = 0;
 	do {
 		for (i = 0; i < nfds; i++) {
-- 
1.9.1

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

* Re: [dpdk-dev] [PATCH] examples/netmap_compat: fix infinite loop
  2016-04-22 10:47 [dpdk-dev] [PATCH] examples/netmap_compat: fix infinite loop Michal Kobylinski
@ 2016-04-22 11:51 ` Mcnamara, John
  2016-04-27 13:22 ` [dpdk-dev] [PATCH v2] " Michal Kobylinski
  1 sibling, 0 replies; 4+ messages in thread
From: Mcnamara, John @ 2016-04-22 11:51 UTC (permalink / raw)
  To: Kobylinski, MichalX, Richardson, Bruce, dev; +Cc: Kobylinski, MichalX

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Michal Kobylinski
> Sent: Friday, April 22, 2016 11:47 AM
> To: Richardson, Bruce <bruce.richardson@intel.com>; dev@dpdk.org
> Cc: Kobylinski, MichalX <michalx.kobylinski@intel.com>
> Subject: [dpdk-dev] [PATCH] examples/netmap_compat: fix infinite loop
> 
> 
> +	if (timeout > 0) {
> +		ret = -1;
> +		return ret;
> +	}
> +

return -1; without the braces is probably okay in this case.

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

* [dpdk-dev] [PATCH v2] examples/netmap_compat: fix infinite loop
  2016-04-22 10:47 [dpdk-dev] [PATCH] examples/netmap_compat: fix infinite loop Michal Kobylinski
  2016-04-22 11:51 ` Mcnamara, John
@ 2016-04-27 13:22 ` Michal Kobylinski
  2016-05-16 16:54   ` Thomas Monjalon
  1 sibling, 1 reply; 4+ messages in thread
From: Michal Kobylinski @ 2016-04-27 13:22 UTC (permalink / raw)
  To: john.mcnamara, dev; +Cc: bruce.richardson, Michal Kobylinski

Fix issue reported by Coverity.

Coverity ID 30701: Infinite loop: The loop does not have a normal
termination condition, so will continue until an abnormal condition
arises. In rte_netmap_poll: Infinite loop with unsatisfiable exit
condition.

Fixes: 06371afe394d ("examples/netmap_compat: import netmap
compatibility example")

Signed-off-by: Michal Kobylinski <michalx.kobylinski@intel.com>
---
v2:
- removed braces
- changed return value on -1

 examples/netmap_compat/lib/compat_netmap.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/examples/netmap_compat/lib/compat_netmap.c b/examples/netmap_compat/lib/compat_netmap.c
index bf1b418..112c551 100644
--- a/examples/netmap_compat/lib/compat_netmap.c
+++ b/examples/netmap_compat/lib/compat_netmap.c
@@ -865,6 +865,9 @@ rte_netmap_poll(struct pollfd *fds, nfds_t nfds, int timeout)
 	uint32_t i, idx, port;
 	uint32_t want_rx, want_tx;
 
+	if (timeout > 0)
+		return -1;
+
 	ret = 0;
 	do {
 		for (i = 0; i < nfds; i++) {
-- 
1.9.1

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

* Re: [dpdk-dev] [PATCH v2] examples/netmap_compat: fix infinite loop
  2016-04-27 13:22 ` [dpdk-dev] [PATCH v2] " Michal Kobylinski
@ 2016-05-16 16:54   ` Thomas Monjalon
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2016-05-16 16:54 UTC (permalink / raw)
  To: dev; +Cc: Michal Kobylinski, john.mcnamara, bruce.richardson

2016-04-27 15:22, Michal Kobylinski:
> Fix issue reported by Coverity.
> 
> Coverity ID 30701: Infinite loop: The loop does not have a normal
> termination condition, so will continue until an abnormal condition
> arises. In rte_netmap_poll: Infinite loop with unsatisfiable exit
> condition.
> 
> Fixes: 06371afe394d ("examples/netmap_compat: import netmap
> compatibility example")
> 
> Signed-off-by: Michal Kobylinski <michalx.kobylinski@intel.com>

Applied, thanks

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

end of thread, other threads:[~2016-05-16 16:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-22 10:47 [dpdk-dev] [PATCH] examples/netmap_compat: fix infinite loop Michal Kobylinski
2016-04-22 11:51 ` Mcnamara, John
2016-04-27 13:22 ` [dpdk-dev] [PATCH v2] " Michal Kobylinski
2016-05-16 16:54   ` 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).