Received: from eggs.gnu.org ([2001:4830:134:3::10]:40801) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cq6Qh-0001dv-5d for qemu-devel@nongnu.org; Mon, 20 Mar 2017 19:09:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cq6Qb-0004t5-SM for qemu-devel@nongnu.org; Mon, 20 Mar 2017 19:09:34 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:34944) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cq6Qb-0004ro-JI for qemu-devel@nongnu.org; Mon, 20 Mar 2017 19:09:29 -0400 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v2KN8j2h025512 for ; Mon, 20 Mar 2017 19:09:28 -0400 Received: from e38.co.us.ibm.com (e38.co.us.ibm.com [32.97.110.159]) by mx0a-001b2d01.pphosted.com with ESMTP id 29ae098ucw-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 20 Mar 2017 19:09:28 -0400 Received: from localhost by e38.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 20 Mar 2017 17:09:27 -0600 From: Michael Roth Date: Mon, 20 Mar 2017 18:07:55 -0500 In-Reply-To: <1490051325-3770-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1490051325-3770-1-git-send-email-mdroth@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Message-Id: <1490051325-3770-32-git-send-email-mdroth@linux.vnet.ibm.com> Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH 31/81] 9pfs: fail local_statfs() earlier List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, Greg Kurz , Greg Kurz From: Greg Kurz If we cannot open the given path, we can return right away instead of passing -1 to fstatfs() and close(). This will make Coverity happy. (Coverity issue CID1371729) Signed-off-by: Greg Kurz Reviewed-by: Daniel P. berrange Reviewed-by: Eric Blake Reviewed-by: Philippe Mathieu-Daud=C3=A9 (cherry picked from commit 23da0145cc4be66fdb1033f951dbbf140f457896) Signed-off-by: Greg Kurz Signed-off-by: Michael Roth --- hw/9pfs/9p-local.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c index c5f7dcd..09b9b57 100644 --- a/hw/9pfs/9p-local.c +++ b/hw/9pfs/9p-local.c @@ -1054,6 +1054,9 @@ static int local_statfs(FsContext *s, V9fsPath *fs_= path, struct statfs *stbuf) int fd, ret; =20 fd =3D local_open_nofollow(s, fs_path->data, O_RDONLY, 0); + if (fd =3D=3D -1) { + return -1; + } ret =3D fstatfs(fd, stbuf); close_preserve_errno(fd); return ret; --=20 2.7.4