examples/netmap_compat: fix infinite loop
authorMichal Kobylinski <michalx.kobylinski@intel.com>
Wed, 27 Apr 2016 13:22:41 +0000 (15:22 +0200)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Mon, 16 May 2016 19:01:51 +0000 (21:01 +0200)
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.

Coverity issue: 30701
Fixes: 06371afe ("examples/netmap_compat: import netmap compatibility example")

Signed-off-by: Michal Kobylinski <michalx.kobylinski@intel.com>
examples/netmap_compat/lib/compat_netmap.c

index bf1b418..112c551 100644 (file)
@@ -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++) {