From cae470b3bfcd2fed2ec29b83e38a3ea78db8e5a1 Mon Sep 17 00:00:00 2001 From: Daniel Mrzyglod Date: Fri, 22 Apr 2016 15:17:09 +0200 Subject: [PATCH] vfio: fix socket option check 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. Fixes: 2f4adfad0a69 ("vfio: add multiprocess support") 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 d9188fdeee..26d966ec61 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.20.1