From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 0A46937AA for ; Wed, 27 Apr 2016 15:50:39 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP; 27 Apr 2016 06:50:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,541,1455004800"; d="scan'208";a="967621535" Received: from gklab-246-020.igk.intel.com (HELO Sent) ([10.217.246.20]) by fmsmga002.fm.intel.com with SMTP; 27 Apr 2016 06:50:36 -0700 Received: by Sent (sSMTP sendmail emulation); Wed, 27 Apr 2016 15:22:53 +0200 From: Michal Kobylinski To: john.mcnamara@intel.com, dev@dpdk.org Cc: bruce.richardson@intel.com, Michal Kobylinski Date: Wed, 27 Apr 2016 15:22:41 +0200 Message-Id: <1461763361-9054-1-git-send-email-michalx.kobylinski@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1461322049-30416-1-git-send-email-michalx.kobylinski@intel.com> References: <1461322049-30416-1-git-send-email-michalx.kobylinski@intel.com> Subject: [dpdk-dev] [PATCH v2] 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: Wed, 27 Apr 2016 13:50:40 -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 --- 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