From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 87B012BA8 for ; Fri, 22 Apr 2016 13:16:07 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 22 Apr 2016 04:16:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,516,1455004800"; d="scan'208";a="964222589" Received: from gklab-246-020.igk.intel.com (HELO Sent) ([10.217.246.20]) by fmsmga002.fm.intel.com with SMTP; 22 Apr 2016 04:16:04 -0700 Received: by Sent (sSMTP sendmail emulation); Fri, 22 Apr 2016 12:47:31 +0200 From: Michal Kobylinski To: bruce.richardson@intel.com, dev@dpdk.org Cc: Michal Kobylinski Date: Fri, 22 Apr 2016 12:47:29 +0200 Message-Id: <1461322049-30416-1-git-send-email-michalx.kobylinski@intel.com> X-Mailer: git-send-email 1.9.1 Subject: [dpdk-dev] [PATCH] examples/netmap_compat: fix infinite loop X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Apr 2016 11:16:07 -0000 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 --- 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