From nobody Mon Apr 29 11:07:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1504627724954857.8789159109457; Tue, 5 Sep 2017 09:08:44 -0700 (PDT) Received: from localhost ([::1]:59991 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dpGP5-0003bd-Vv for importer@patchew.org; Tue, 05 Sep 2017 12:08:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34585) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dpGHP-0006Nx-4m for qemu-devel@nongnu.org; Tue, 05 Sep 2017 12:00:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dpGHF-0000N4-Tr for qemu-devel@nongnu.org; Tue, 05 Sep 2017 12:00:47 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:37417) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dpGHF-0000LM-0v for qemu-devel@nongnu.org; Tue, 05 Sep 2017 12:00:37 -0400 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v85Fwa2M097149 for ; Tue, 5 Sep 2017 12:00:35 -0400 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 2csvwnya7y-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 05 Sep 2017 12:00:35 -0400 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 5 Sep 2017 17:00:32 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 5 Sep 2017 17:00:30 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v85G0Uat11403500; Tue, 5 Sep 2017 16:00:30 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AE881AE045; Tue, 5 Sep 2017 16:55:46 +0100 (BST) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9C403AE053; Tue, 5 Sep 2017 16:55:46 +0100 (BST) Received: from smtp.lab.toulouse-stg.fr.ibm.com (unknown [9.101.4.1]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 5 Sep 2017 16:55:46 +0100 (BST) Received: from bahia.lab.toulouse-stg.fr.ibm.com (bahia.lab.toulouse-stg.fr.ibm.com [9.101.4.41]) by smtp.lab.toulouse-stg.fr.ibm.com (Postfix) with ESMTP id AAA4522023E; Tue, 5 Sep 2017 18:00:29 +0200 (CEST) From: Greg Kurz To: qemu-devel@nongnu.org Date: Tue, 5 Sep 2017 18:00:24 +0200 X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170905160027.15081-1-groug@kaod.org> References: <20170905160027.15081-1-groug@kaod.org> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 17090516-0040-0000-0000-000003F5C4BE X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17090516-0041-0000-0000-000020963C57 Message-Id: <20170905160027.15081-2-groug@kaod.org> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-09-05_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=3 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1709050229 Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by mx0a-001b2d01.pphosted.com id v85Fwa2M097149 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PULL v2 1/4] 9pfs: avoid sign conversion error simplifying the code X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Greg Kurz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Philippe Mathieu-Daud=C3=A9 (note this is how other functions also handle the errors). hw/9pfs/9p.c:948:18: warning: Loss of sign in implicit conversion offset =3D err; ^~~ Reported-by: Clang Static Analyzer Signed-off-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Greg Kurz --- hw/9pfs/9p.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index 333dbb6f8ee2..0a37c8bd1361 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -945,7 +945,6 @@ static void coroutine_fn v9fs_version(void *opaque) v9fs_string_init(&version); err =3D pdu_unmarshal(pdu, offset, "ds", &s->msize, &version); if (err < 0) { - offset =3D err; goto out; } trace_v9fs_version(pdu->tag, pdu->id, s->msize, version.data); @@ -962,13 +961,12 @@ static void coroutine_fn v9fs_version(void *opaque) =20 err =3D pdu_marshal(pdu, offset, "ds", s->msize, &version); if (err < 0) { - offset =3D err; goto out; } - offset +=3D err; + err +=3D offset; trace_v9fs_version_return(pdu->tag, pdu->id, s->msize, version.data); out: - pdu_complete(pdu, offset); + pdu_complete(pdu, err); v9fs_string_free(&version); } =20 --=20 2.13.5 From nobody Mon Apr 29 11:07:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 150462752927461.02443972243134; Tue, 5 Sep 2017 09:05:29 -0700 (PDT) Received: from localhost ([::1]:59957 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dpGLv-00018p-Ou for importer@patchew.org; Tue, 05 Sep 2017 12:05:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34621) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dpGHR-0006Pv-W2 for qemu-devel@nongnu.org; Tue, 05 Sep 2017 12:00:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dpGHI-0000Q9-Nx for qemu-devel@nongnu.org; Tue, 05 Sep 2017 12:00:50 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:38713) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dpGHI-0000Oy-DE for qemu-devel@nongnu.org; Tue, 05 Sep 2017 12:00:40 -0400 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v85G0Z6b110997 for ; Tue, 5 Sep 2017 12:00:39 -0400 Received: from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com [195.75.94.106]) by mx0a-001b2d01.pphosted.com with ESMTP id 2csu2wd7e3-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 05 Sep 2017 12:00:38 -0400 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 5 Sep 2017 17:00:33 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 5 Sep 2017 17:00:30 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v85G0UWG12124244; Tue, 5 Sep 2017 16:00:30 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9B99911C04A; Tue, 5 Sep 2017 16:56:52 +0100 (BST) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8990711C052; Tue, 5 Sep 2017 16:56:52 +0100 (BST) Received: from smtp.lab.toulouse-stg.fr.ibm.com (unknown [9.101.4.1]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 5 Sep 2017 16:56:52 +0100 (BST) Received: from bahia.lab.toulouse-stg.fr.ibm.com (bahia.lab.toulouse-stg.fr.ibm.com [9.101.4.41]) by smtp.lab.toulouse-stg.fr.ibm.com (Postfix) with ESMTP id BAD07220409; Tue, 5 Sep 2017 18:00:29 +0200 (CEST) From: Greg Kurz To: qemu-devel@nongnu.org Date: Tue, 5 Sep 2017 18:00:25 +0200 X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170905160027.15081-1-groug@kaod.org> References: <20170905160027.15081-1-groug@kaod.org> X-TM-AS-GCONF: 00 x-cbid: 17090516-0040-0000-0000-000003D5C5F4 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17090516-0041-0000-0000-000025D64AD1 Message-Id: <20170905160027.15081-3-groug@kaod.org> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-09-05_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=8 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1709050229 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PULL v2 2/4] fsdev: fix memory leak in main() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , ZhiPeng Lu , Greg Kurz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: ZhiPeng Lu @rpath and @sock_name are not freed and leaked. [groug, not really leaked since the program exits just after that. But it is always good practice to free allocated memory] Signed-off-by: Zhipeng Lu Signed-off-by: Greg Kurz --- fsdev/virtfs-proxy-helper.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fsdev/virtfs-proxy-helper.c b/fsdev/virtfs-proxy-helper.c index 6c066ec9a0ce..8e48500dd53a 100644 --- a/fsdev/virtfs-proxy-helper.c +++ b/fsdev/virtfs-proxy-helper.c @@ -1162,6 +1162,8 @@ int main(int argc, char **argv) =20 process_requests(sock); error: + g_free(rpath); + g_free(sock_name); do_log(LOG_INFO, "Done\n"); closelog(); return 0; --=20 2.13.5 From nobody Mon Apr 29 11:07:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1504627807417805.5542934533211; Tue, 5 Sep 2017 09:10:07 -0700 (PDT) Received: from localhost ([::1]:60005 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dpGQQ-0004Zf-GA for importer@patchew.org; Tue, 05 Sep 2017 12:10:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34555) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dpGHK-0006Kf-SW for qemu-devel@nongnu.org; Tue, 05 Sep 2017 12:00:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dpGHD-0000KQ-8c for qemu-devel@nongnu.org; Tue, 05 Sep 2017 12:00:42 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:59703 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dpGHD-0000JV-3V for qemu-devel@nongnu.org; Tue, 05 Sep 2017 12:00:35 -0400 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v85Fwo23017495 for ; Tue, 5 Sep 2017 12:00:34 -0400 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0b-001b2d01.pphosted.com with ESMTP id 2csweq59vg-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 05 Sep 2017 12:00:34 -0400 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 5 Sep 2017 17:00:32 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 5 Sep 2017 17:00:30 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v85G0UhS14876868; Tue, 5 Sep 2017 16:00:30 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D3A29AE045; Tue, 5 Sep 2017 16:55:46 +0100 (BST) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C1138AE04D; Tue, 5 Sep 2017 16:55:46 +0100 (BST) Received: from smtp.lab.toulouse-stg.fr.ibm.com (unknown [9.101.4.1]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 5 Sep 2017 16:55:46 +0100 (BST) Received: from bahia.lab.toulouse-stg.fr.ibm.com (bahia.lab.toulouse-stg.fr.ibm.com [9.101.4.41]) by smtp.lab.toulouse-stg.fr.ibm.com (Postfix) with ESMTP id CAF4A22040A; Tue, 5 Sep 2017 18:00:29 +0200 (CEST) From: Greg Kurz To: qemu-devel@nongnu.org Date: Tue, 5 Sep 2017 18:00:26 +0200 X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170905160027.15081-1-groug@kaod.org> References: <20170905160027.15081-1-groug@kaod.org> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 17090516-0020-0000-0000-000003B3C613 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17090516-0021-0000-0000-000042443047 Message-Id: <20170905160027.15081-4-groug@kaod.org> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-09-05_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1709050229 Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by mx0b-001b2d01.pphosted.com id v85Fwo23017495 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PULL v2 3/4] 9pfs: local: clarify fchmodat_nofollow() implementation X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Greg Kurz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Since fchmodat(2) on Linux doesn't support AT_SYMLINK_NOFOLLOW, we have to implement it using workarounds. There are two different ways, depending on whether the system supports O_PATH or not. In the case O_PATH is supported, we rely on the behavhior of openat(2) when passing O_NOFOLLOW | O_PATH and the file is a symbolic link. Even if openat_file() already adds O_NOFOLLOW to the flags, this patch makes it explicit that we need both creation flags to obtain the expected behavior. This is only cleanup, no functional change. Signed-off-by: Greg Kurz Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/9pfs/9p-local.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c index efb0b79a74bf..e51af87309c6 100644 --- a/hw/9pfs/9p-local.c +++ b/hw/9pfs/9p-local.c @@ -349,11 +349,11 @@ static int fchmodat_nofollow(int dirfd, const char *n= ame, mode_t mode) return -1; } =20 - /* Access modes are ignored when O_PATH is supported. We try O_RDONLY = and - * O_WRONLY for old-systems that don't support O_PATH. - */ - fd =3D openat_file(dirfd, name, O_RDONLY | O_PATH_9P_UTIL, 0); + fd =3D openat_file(dirfd, name, O_RDONLY | O_PATH_9P_UTIL | O_NOFOLLOW= , 0); #if O_PATH_9P_UTIL =3D=3D 0 + /* Fallback for systems that don't support O_PATH: we depend on the fi= le + * being readable or writable. + */ if (fd =3D=3D -1) { /* In case the file is writable-only and isn't a directory. */ if (errno =3D=3D EACCES) { @@ -368,6 +368,10 @@ static int fchmodat_nofollow(int dirfd, const char *na= me, mode_t mode) } ret =3D fchmod(fd, mode); #else + /* Access modes are ignored when O_PATH is supported. If name is a sym= bolic + * link, O_PATH | O_NOFOLLOW causes openat(2) to return a file descrip= tor + * referring to the symbolic link. + */ if (fd =3D=3D -1) { return -1; } --=20 2.13.5 From nobody Mon Apr 29 11:07:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1504627573013236.7880757362808; Tue, 5 Sep 2017 09:06:13 -0700 (PDT) Received: from localhost ([::1]:59980 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dpGMd-0001la-VM for importer@patchew.org; Tue, 05 Sep 2017 12:06:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34541) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dpGHJ-0006Jh-Qg for qemu-devel@nongnu.org; Tue, 05 Sep 2017 12:00:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dpGHF-0000MQ-2c for qemu-devel@nongnu.org; Tue, 05 Sep 2017 12:00:41 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:42634 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dpGHE-0000LZ-OE for qemu-devel@nongnu.org; Tue, 05 Sep 2017 12:00:36 -0400 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v85Fwa2i118574 for ; Tue, 5 Sep 2017 12:00:36 -0400 Received: from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com [195.75.94.106]) by mx0b-001b2d01.pphosted.com with ESMTP id 2csv20j01p-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 05 Sep 2017 12:00:35 -0400 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 5 Sep 2017 17:00:33 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 5 Sep 2017 17:00:30 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v85G0UiC12124246; Tue, 5 Sep 2017 16:00:30 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B8C3811C04A; Tue, 5 Sep 2017 16:56:52 +0100 (BST) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A65F311C054; Tue, 5 Sep 2017 16:56:52 +0100 (BST) Received: from smtp.lab.toulouse-stg.fr.ibm.com (unknown [9.101.4.1]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 5 Sep 2017 16:56:52 +0100 (BST) Received: from bahia.lab.toulouse-stg.fr.ibm.com (bahia.lab.toulouse-stg.fr.ibm.com [9.101.4.41]) by smtp.lab.toulouse-stg.fr.ibm.com (Postfix) with ESMTP id DB1AD220463; Tue, 5 Sep 2017 18:00:29 +0200 (CEST) From: Greg Kurz To: qemu-devel@nongnu.org Date: Tue, 5 Sep 2017 18:00:27 +0200 X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170905160027.15081-1-groug@kaod.org> References: <20170905160027.15081-1-groug@kaod.org> X-TM-AS-GCONF: 00 x-cbid: 17090516-0040-0000-0000-000003D5C5F3 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17090516-0041-0000-0000-000025D64AD2 Message-Id: <20170905160027.15081-5-groug@kaod.org> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-09-05_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1709050229 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PULL v2 4/4] virtfs: error out gracefully when mandatory suboptions are missing X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Greg Kurz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We internally convert -virtfs to -fsdev/-device. If the user doesn't provide the path or security_model suboptions, and the fsdev backend requires them, we hit an assertion when populating the internal -fsdev option: util/qemu-option.c:547: opt_set: Assertion `opt->str' failed. Aborted (core dumped) Let's test the suboption presence on the command line before trying to set it in the internal -fsdev option, and let the backend code error out gracefully (ie, like it already does when the user passes -fsdev on the command line). Reported-by: Thomas Huth Signed-off-by: Greg Kurz Reviewed-by: Thomas Huth --- vl.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/vl.c b/vl.c index 0b45e1b6fa31..e75757f9772e 100644 --- a/vl.c +++ b/vl.c @@ -3557,7 +3557,7 @@ int main(int argc, char **argv, char **envp) case QEMU_OPTION_virtfs: { QemuOpts *fsdev; QemuOpts *device; - const char *writeout, *sock_fd, *socket; + const char *writeout, *sock_fd, *socket, *path, *security_= model; =20 olist =3D qemu_find_opts("virtfs"); if (!olist) { @@ -3596,11 +3596,15 @@ int main(int argc, char **argv, char **envp) } qemu_opt_set(fsdev, "fsdriver", qemu_opt_get(opts, "fsdriver"), &error_abort); - qemu_opt_set(fsdev, "path", qemu_opt_get(opts, "path"), - &error_abort); - qemu_opt_set(fsdev, "security_model", - qemu_opt_get(opts, "security_model"), - &error_abort); + path =3D qemu_opt_get(opts, "path"); + if (path) { + qemu_opt_set(fsdev, "path", path, &error_abort); + } + security_model =3D qemu_opt_get(opts, "security_model"); + if (security_model) { + qemu_opt_set(fsdev, "security_model", security_model, + &error_abort); + } socket =3D qemu_opt_get(opts, "socket"); if (socket) { qemu_opt_set(fsdev, "socket", socket, &error_abort); --=20 2.13.5