From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id A6BCE2716 for ; Fri, 22 Apr 2016 14:14:54 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP; 22 Apr 2016 05:14:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,517,1455004800"; d="scan'208";a="950699365" Received: from gklab-246-025.igk.intel.com (HELO Sent) ([10.217.246.25]) by fmsmga001.fm.intel.com with SMTP; 22 Apr 2016 05:14:42 -0700 Received: by Sent (sSMTP sendmail emulation); Fri, 22 Apr 2016 15:17:16 +0200 From: Daniel Mrzyglod To: dev@dpdk.org Cc: Daniel Mrzyglod Date: Fri, 22 Apr 2016 15:17:09 +0200 Message-Id: <1461331029-192359-1-git-send-email-danielx.t.mrzyglod@intel.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1461239817-96357-1-git-send-email-danielx.t.mrzyglod@intel.com> References: <1461239817-96357-1-git-send-email-danielx.t.mrzyglod@intel.com> Subject: [dpdk-dev] [PATCH v2] eal: fix unchecked return value from library 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 12:14:55 -0000 Fix issue reported by Coverity. Coverity ID 13194 The function returns a value that indicates an error condition. If this is not checked, the error condition may not be handled correctly. In pci_vfio_mp_sync_thread: Value returned from a library function is not checked for errors before being used. This value may indicate an error condition. Fixes: 2f4adfad0a69 ("vfio: add multiprocess support") v2: Changed ERR to WARNING because it has no real impact on the application usability Signed-off-by: Daniel Mrzyglod Acked-by: Anatoly Burakov --- lib/librte_eal/linuxapp/eal/eal_pci_vfio_mp_sync.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio_mp_sync.c b/lib/librte_eal/linuxapp/eal/eal_pci_vfio_mp_sync.c index d9188fd..26d966e 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio_mp_sync.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio_mp_sync.c @@ -287,7 +287,10 @@ pci_vfio_mp_sync_thread(void __rte_unused * arg) struct linger l; l.l_onoff = 1; l.l_linger = 60; - setsockopt(conn_sock, SOL_SOCKET, SO_LINGER, &l, sizeof(l)); + + if (setsockopt(conn_sock, SOL_SOCKET, SO_LINGER, &l, sizeof(l)) < 0) + RTE_LOG(WARNING, EAL, "Cannot set SO_LINGER option " + "on listen socket (%s)\n", strerror(errno)); ret = vfio_mp_sync_receive_request(conn_sock); -- 2.5.5