From nobody Thu Nov 13 20:42:51 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1582811022; cv=none; d=zohomail.com; s=zohoarc; b=X8W9VXw1iG7xcHRMow8fOeIPgLF5Pvd7sG5OQadB5ubuPJfM0d5BLpvRjJEybQb+CVTCM+leqrnLlwMODNL8mIQwR4wIwZa2gaN47a70rDEJ6//rLJ2V+3P8XOw5YPvouNbMwcK8qEy/KrHc4+ZP8GlD6xX8XAoJnj8zfiJWO4I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582811022; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=RtOhkYC4ODRfNBe2De1EnYqq2199pB/cAmZAzhgnQ+k=; b=Iv6bCH+4f2YJfdo//jb9Hyu9R7i4c5SRzzqgFRqniRx91226T7s7lKOH2qDcx97QVF1E+GqCnCyGReimaZDMzJ4JviKMgXsUhKGZWeBF4mXI/bLaSkYrygsJh4mA9j49MZ7WN19T9Bg/g8POLD88vUrpYB3XBvBcFsPMHRsVV/w= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1582811022387827.4831958476432; Thu, 27 Feb 2020 05:43:42 -0800 (PST) Received: from localhost ([::1]:59848 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j7JS1-0005mn-44 for importer@patchew.org; Thu, 27 Feb 2020 08:43:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37350) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j7JRM-0005DL-Th for qemu-devel@nongnu.org; Thu, 27 Feb 2020 08:43:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j7JRL-0005DB-VE for qemu-devel@nongnu.org; Thu, 27 Feb 2020 08:43:00 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:15679 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 1j7JRL-0005Cp-PZ for qemu-devel@nongnu.org; Thu, 27 Feb 2020 08:42:59 -0500 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 01RDeclx190918 for ; Thu, 27 Feb 2020 08:42:58 -0500 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0b-001b2d01.pphosted.com with ESMTP id 2yden2fxu2-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 27 Feb 2020 08:42:58 -0500 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 27 Feb 2020 13:42:56 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 27 Feb 2020 13:42:52 -0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 01RDgpIw38994046 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 27 Feb 2020 13:42:51 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 92B124C046; Thu, 27 Feb 2020 13:42:51 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AD9E94C040; Thu, 27 Feb 2020 13:42:50 +0000 (GMT) Received: from lep8c.aus.stglabs.ibm.com (unknown [9.40.192.207]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 27 Feb 2020 13:42:50 +0000 (GMT) Subject: [PATCH v2] spapr: Fix Coverity warning while validating nvdimm options From: Shivaprasad G Bhat To: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au Date: Thu, 27 Feb 2020 07:42:49 -0600 User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 x-cbid: 20022713-0020-0000-0000-000003AE22D9 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20022713-0021-0000-0000-000022064212 Message-Id: <158281096564.89540.4507375445765515529.stgit@lep8c.aus.stglabs.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.572 definitions=2020-02-27_04:2020-02-26, 2020-02-27 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 mlxlogscore=790 adultscore=0 spamscore=0 suspectscore=2 priorityscore=1501 impostorscore=0 phishscore=0 clxscore=1015 malwarescore=0 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002270108 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 148.163.158.5 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, groug@kaod.org, f4bug@amsat.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Fixes Coverity issue, CID 1419883: Error handling issues (CHECKED_RETURN) Calling "qemu_uuid_parse" without checking return value nvdimm_set_uuid() already verifies if the user provided uuid is valid or not. So, need to check for the validity during pre-plug validation again. As this a false positive in this case, assert if not valid to be safe. Also, error_abort if QOM accessor encounters error while fetching the uuid property. Reported-by: Coverity (CID 1419883) Signed-off-by: Shivaprasad G Bhat Reviewed-by: Greg Kurz --- hw/ppc/spapr_nvdimm.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hw/ppc/spapr_nvdimm.c b/hw/ppc/spapr_nvdimm.c index 74eeb8bb74..25be8082d7 100644 --- a/hw/ppc/spapr_nvdimm.c +++ b/hw/ppc/spapr_nvdimm.c @@ -35,6 +35,7 @@ void spapr_nvdimm_validate_opts(NVDIMMDevice *nvdimm, uin= t64_t size, { char *uuidstr =3D NULL; QemuUUID uuid; + int ret; =20 if (size % SPAPR_MINIMUM_SCM_BLOCK_SIZE) { error_setg(errp, "NVDIMM memory size excluding the label area" @@ -43,8 +44,10 @@ void spapr_nvdimm_validate_opts(NVDIMMDevice *nvdimm, ui= nt64_t size, return; } =20 - uuidstr =3D object_property_get_str(OBJECT(nvdimm), NVDIMM_UUID_PROP, = NULL); - qemu_uuid_parse(uuidstr, &uuid); + uuidstr =3D object_property_get_str(OBJECT(nvdimm), NVDIMM_UUID_PROP, + &error_abort); + ret =3D qemu_uuid_parse(uuidstr, &uuid); + g_assert(!ret); g_free(uuidstr); =20 if (qemu_uuid_is_null(&uuid)) {