From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 331C6276C; Fri, 22 Sep 2017 14:26:25 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP; 22 Sep 2017 05:26:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,427,1500966000"; d="scan'208";a="1174824641" Received: from unknown (HELO Sent) ([10.103.102.91]) by orsmga001.jf.intel.com with SMTP; 22 Sep 2017 05:26:21 -0700 Received: by Sent (sSMTP sendmail emulation); Fri, 22 Sep 2017 14:17:42 +0200 From: Kuba Kozak To: yliu@fridaylinux.org, maxime.coquelin@redhat.com Cc: dev@dpdk.org, Kuba Kozak , jan.wickbom@ericsson.com, stable@dpdk.org Date: Fri, 22 Sep 2017 14:17:40 +0200 Message-Id: <1506082660-46479-1-git-send-email-kubax.kozak@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [dpdk-dev] [PATCH] vhost: fix unchecked return value X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Sep 2017 12:26:25 -0000 Add return value check for poll() call. Coverity issue: 140740 Fixes: 59317cef249c ("vhost: allow many vhost-user ports") Cc: jan.wickbom@ericsson.com Cc: stable@dpdk.org Signed-off-by: Kuba Kozak --- lib/librte_vhost/fd_man.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/librte_vhost/fd_man.c b/lib/librte_vhost/fd_man.c index 2ceacc9..4c6fed4 100644 --- a/lib/librte_vhost/fd_man.c +++ b/lib/librte_vhost/fd_man.c @@ -222,6 +222,7 @@ fdset_event_dispatch(void *arg) int remove1, remove2; int need_shrink; struct fdset *pfdset = arg; + int val; if (pfdset == NULL) return NULL; @@ -239,7 +240,9 @@ fdset_event_dispatch(void *arg) numfds = pfdset->num; pthread_mutex_unlock(&pfdset->fd_mutex); - poll(pfdset->rwfds, numfds, 1000 /* millisecs */); + val = poll(pfdset->rwfds, numfds, 1000 /* millisecs */); + if (val < 0) + continue; need_shrink = 0; for (i = 0; i < numfds; i++) { -- 2.7.4