Received: from eggs.gnu.org ([2001:4830:134:3::10]:50622) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ckwqE-0005J0-J6 for qemu-devel@nongnu.org; Mon, 06 Mar 2017 12:54:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ckwqB-0005dO-DE for qemu-devel@nongnu.org; Mon, 06 Mar 2017 12:54:38 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:37020) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ckwqB-0005d6-3d for qemu-devel@nongnu.org; Mon, 06 Mar 2017 12:54:35 -0500 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v26HrsHC092786 for ; Mon, 6 Mar 2017 12:54:32 -0500 Received: from e06smtp09.uk.ibm.com (e06smtp09.uk.ibm.com [195.75.94.105]) by mx0a-001b2d01.pphosted.com with ESMTP id 2917pm78mu-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 06 Mar 2017 12:54:32 -0500 Received: from localhost by e06smtp09.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 6 Mar 2017 17:54:30 -0000 From: Greg Kurz Date: Mon, 6 Mar 2017 18:54:05 +0100 In-Reply-To: <1488822850-23070-1-git-send-email-groug@kaod.org> References: <1488822850-23070-1-git-send-email-groug@kaod.org> Message-Id: <1488822850-23070-2-git-send-email-groug@kaod.org> Subject: [Qemu-devel] [PULL 1/6] 9pfs: fix bogus fd check in local_remove() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Greg Kurz This was spotted by Coverity as a fd leak. This is certainly true, but also local_remove() would always return without doing anything, unless the fd is zero, which is very unlikely. (Coverity issue CID1371732) Signed-off-by: Greg Kurz Reviewed-by: Eric Blake --- hw/9pfs/9p-local.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c index f22a3c3654db..5db7104334d6 100644 --- a/hw/9pfs/9p-local.c +++ b/hw/9pfs/9p-local.c @@ -1008,7 +1008,7 @@ static int local_remove(FsContext *ctx, const char *path) int err = -1; dirfd = local_opendir_nofollow(ctx, dirpath); - if (dirfd) { + if (dirfd == -1) { goto out; } -- 2.7.4