From nobody Mon May 20 06:18:24 2024 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; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1575454097; cv=none; d=zohomail.com; s=zohoarc; b=VeijGj7BN4zhgxU/lpPAH2oIlmEk5RbpG27PNT+rbmut1f8SEHDFCAQfQf7JGIuhardMJ/Tx1VNx9W139Zofv1bq9HfU/8Rci+PmjxyVw9XdR6nKoJSwb6sHpMvnCZvM+wrQNdv4AS4KuNby0Hsi06p3K3Xx9LdNZSDXyC60I8I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575454097; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=E4N9e38HWdd95QkHzCa+MZyOQk8kGL3rr8n3UF0VKIQ=; b=nEqdzKq/Tsq2p74v7yr4hz2t+akiiP5UC+5cf8kmmC1GLy+jgKuN8UtbYu4CS98Ydz08w/78DXcbRxPmJrieKlr93t2BR2Y2NSknexxWJwHqvqHag/sUc1mM+MXDzrr3onJ/vtM+bEduzuZg96gQvkWKjUYQT5iR/r9rUyZ9eGM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass 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 1575454097852973.4028797114802; Wed, 4 Dec 2019 02:08:17 -0800 (PST) Received: from localhost ([::1]:36410 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icRZr-0001BA-QD for importer@patchew.org; Wed, 04 Dec 2019 05:08:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38577) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icR5P-0007Cj-82 for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1icR5E-00004w-4S for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:36 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:32101 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1icR5D-0008Mf-Va for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:32 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-276-u0GUppxHO-KEEOmANgB0Gg-1; Wed, 04 Dec 2019 04:36:28 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 362F78017DF for ; Wed, 4 Dec 2019 09:36:27 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-134.ams2.redhat.com [10.36.116.134]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 03A49600CC; Wed, 4 Dec 2019 09:36:27 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 85E0D11385C7; Wed, 4 Dec 2019 10:36:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575452189; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=E4N9e38HWdd95QkHzCa+MZyOQk8kGL3rr8n3UF0VKIQ=; b=KZJQM1V+IZL0jLNsnv1C24dahWOCOgjHzrN1toaEGomkoJ3sbsyph4nrH7Lda3T6nrbRO0 Ynw2y/Dvpfyl/oGFVH5DRoraJwdfJA5vw41If/ykSc/W2Z5TAvkIcfYuIRZVglrExNh7an eacufnXH7v+vJh29oWGIzcQhq5qdrz4= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH v2 01/18] crypto: Fix certificate file error handling crash bug Date: Wed, 4 Dec 2019 10:36:08 +0100 Message-Id: <20191204093625.14836-2-armbru@redhat.com> In-Reply-To: <20191204093625.14836-1-armbru@redhat.com> References: <20191204093625.14836-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: u0GUppxHO-KEEOmANgB0Gg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 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: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" qcrypto_tls_creds_load_cert() passes uninitialized GError *gerr by reference to g_file_get_contents(). When g_file_get_contents() fails, it'll try to set a GError. Unless @gerr is null by dumb luck, this logs a ERROR_OVERWRITTEN_WARNING warning message and leaves @gerr unchanged. qcrypto_tls_creds_load_cert() then dereferences the uninitialized @gerr. Fix by initializing @gerr properly. Fixes: 9a2fd4347c40321f5cbb4ab4220e759fcbf87d03 Cc: "Daniel P. Berrang=C3=A9" Signed-off-by: Markus Armbruster Acked-by: Daniel P. Berrang=C3=A9 --- crypto/tlscredsx509.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/tlscredsx509.c b/crypto/tlscredsx509.c index 01fc304e5d..53a4368f49 100644 --- a/crypto/tlscredsx509.c +++ b/crypto/tlscredsx509.c @@ -380,7 +380,7 @@ qcrypto_tls_creds_load_cert(QCryptoTLSCredsX509 *creds, gnutls_x509_crt_t cert =3D NULL; g_autofree char *buf =3D NULL; gsize buflen; - GError *gerr; + GError *gerr =3D NULL; int ret =3D -1; int err; =20 --=20 2.21.0 From nobody Mon May 20 06:18:24 2024 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; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1575454807; cv=none; d=zohomail.com; s=zohoarc; b=MGtubmS7oNDgo8TVunfyjgSfB9kdNGoxKLcfiDP/44Y9DrItwJTLSk3QgeKcagjPlzu0dwvVTEC8I+nEtgIKA6LfXorsUETjXN3Q6yGyrfnu4yt5BeTkBSERz0q5UEqR5BvsWEawbJJBOm2glCd+ubUv0lIZ53ykvCwjhrfi9Tg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575454807; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=z5LJs4qmj5nbhlefhQkW8UndCpDHWlAMIMigpcb7EAg=; b=iJwxitYrL6QzouQvVDyXGRISzyld0LfZBjlr78PViMhYxU9vOLE8NHCmigDWLBUWDgpcY3PJ9YmDaCB/9dX59Wocuzn9BvUpjLkBXH1nYw5+czwZeeZ/6zfaYUWafwovVk3i9h64pPpMzT40592FCzz07ZZ+pu1RWgMHCF/uElU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass 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 1575454807487131.25312889355575; Wed, 4 Dec 2019 02:20:07 -0800 (PST) Received: from localhost ([::1]:36492 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icRlK-0005yI-DE for importer@patchew.org; Wed, 04 Dec 2019 05:20:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38433) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icR5K-0007Bs-Gx for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1icR5E-000051-4j for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:34 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:43854 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1icR5E-0008O5-02 for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:32 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-100-bC-dmC6TOVy0UdIxbQmB1A-1; Wed, 04 Dec 2019 04:36:28 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 36B69800D54 for ; Wed, 4 Dec 2019 09:36:27 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-134.ams2.redhat.com [10.36.116.134]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 052C1600CD; Wed, 4 Dec 2019 09:36:27 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 888B511366CC; Wed, 4 Dec 2019 10:36:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575452189; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=z5LJs4qmj5nbhlefhQkW8UndCpDHWlAMIMigpcb7EAg=; b=Zc+RSxkLrKIl4vZWD8LabiseQC8WrYTZIttZRqahDaDHFJiw6ZMuw8XrJe9/FvNSC+EV4A vbCusAtIl0EPQwrGfkjwQrLtTITsf1ygyPUDNDhT00nauVfdAl8KD1HzwnlV+g62aXH55y DgEtVtxlysTwGoaHfAVwJvpjMr86B5w= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH v2 02/18] crypto: Fix typo in QCryptoTLSSession's comment Date: Wed, 4 Dec 2019 10:36:09 +0100 Message-Id: <20191204093625.14836-3-armbru@redhat.com> In-Reply-To: <20191204093625.14836-1-armbru@redhat.com> References: <20191204093625.14836-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: bC-dmC6TOVy0UdIxbQmB1A-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 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: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Cc: "Daniel P. Berrang=C3=A9" Signed-off-by: Markus Armbruster Acked-by: Daniel P. Berrang=C3=A9 --- include/crypto/tlssession.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/crypto/tlssession.h b/include/crypto/tlssession.h index e01e1a9dc2..15b9cef086 100644 --- a/include/crypto/tlssession.h +++ b/include/crypto/tlssession.h @@ -56,7 +56,7 @@ * * static int mysock_run_tls(int sockfd, * QCryptoTLSCreds *creds, - * Error *errp) + * Error **errp) * { * QCryptoTLSSession *sess; * --=20 2.21.0 From nobody Mon May 20 06:18:24 2024 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; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1575456062; cv=none; d=zohomail.com; s=zohoarc; b=Vh7HxF73nuBhCNl1Vkr2FP3btaW9cvdTontZS2wiTSAZA+PtGJQRHLx3NwcGRMQg2Q9ALDEyIjTkYDx3CKuVsDxKm5BIPHdy/C6KvETOq9ccFV7r8Xs6ZGek1jJsOkqfENKG3dWl8imL7WrOihFObSOTLlit/CdqJfgszs6WmwA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575456062; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=dc9Zi859fZ/6PNfDggKzxG0kjve40PrhKYv1nIJAHo0=; b=F8/Vq6Lxpy3NRa+sOx35fwxeQngFTwB/u3aXJEAczxBEmw9cKFDN33GHZEwm3W+hsEOwdbmG2Gp5KJu0wNBMRKvw2k+CgS8J6Hz6DeEw3UB547+G3NTyyWFu3FnQRMesH4GR3ZwU05dMacz/9Jp35uZxTBYbunGmWJ6PrZHnIlI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass 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 1575456062269632.8523808600669; Wed, 4 Dec 2019 02:41:02 -0800 (PST) Received: from localhost ([::1]:36630 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icS5c-0007l6-RA for importer@patchew.org; Wed, 04 Dec 2019 05:41:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38945) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icR5Y-0007FG-9P for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1icR5F-00009t-8f for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:44 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:59425 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1icR5F-0008Mr-4J for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:33 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-407-J9p1byTTM3a4AA3TGpsfHA-1; Wed, 04 Dec 2019 04:36:28 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3D8CC800D5A for ; Wed, 4 Dec 2019 09:36:27 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-134.ams2.redhat.com [10.36.116.134]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0B43C1001938; Wed, 4 Dec 2019 09:36:27 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 8BC8911366CF; Wed, 4 Dec 2019 10:36:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575452189; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dc9Zi859fZ/6PNfDggKzxG0kjve40PrhKYv1nIJAHo0=; b=et88UFRFcVj4gGwEtEhVP2ZTbRBehzBTZ6rJNxab+433PbB8wF62HyNTcLRRtymRRr7j1B tqudrdNtvleQ4NqLFwph7QXtRcAHNDiIzMaBeo96/YMJ+V/V9QXNn2V5WDfInE+R95GXrG ciSdDVFV6lOEpJuaa/HK1a3qxK967mc= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH v2 03/18] io: Fix Error usage in a comment Date: Wed, 4 Dec 2019 10:36:10 +0100 Message-Id: <20191204093625.14836-4-armbru@redhat.com> In-Reply-To: <20191204093625.14836-1-armbru@redhat.com> References: <20191204093625.14836-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: J9p1byTTM3a4AA3TGpsfHA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 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: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Cc: "Daniel P. Berrang=C3=A9" Signed-off-by: Markus Armbruster Acked-by: Daniel P. Berrang=C3=A9 --- include/io/task.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/io/task.h b/include/io/task.h index 5cb9faf9f2..1abbfb8b65 100644 --- a/include/io/task.h +++ b/include/io/task.h @@ -119,7 +119,7 @@ typedef void (*QIOTaskWorker)(QIOTask *task, * gboolean myobject_operation_timer(gpointer opaque) * { * QIOTask *task =3D QIO_TASK(opaque); - * Error *err;* + * Error *err =3D NULL; * * ...check something important... * if (err) { --=20 2.21.0 From nobody Mon May 20 06:18:24 2024 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; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1575452667; cv=none; d=zohomail.com; s=zohoarc; b=RwOwZP4sVRPXzkNgST7of2TyX08gAa5Hz8/XpbGEcffPfOzFg73r+zrVRrwDtzV8PTFt4Op103J5nJxvm+N+fsmAZbMuO1vcTBt4v4FInOjIk8nnjJb1/VHIwkL5VPxvlBnhIj1wNtCIwf5NIlVj68nr0kWrpaII0I1XE3pqb+Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575452667; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=KAnozijQnJ7jZgrp+o4jADOZ48ZvoJvjxYWiOwhxZ0o=; b=EY6BL2RdguzvldNzVAURiiWMgxOlhU6nolgue34z8jvg9dKN85ocoZ5iMcNMmWDs1ELcMC89Feo8ntZVaAWHMUczplWZ4iH3eBgvA68C3O4t9cnlegOmyknprwPBxFh04zcnbNpLEzXPM6iaHIeO+v8BMIXC11mK72QH4b9UCVc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass 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 1575452667275474.86332869735895; Wed, 4 Dec 2019 01:44:27 -0800 (PST) Received: from localhost ([::1]:36248 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icRCn-00011Q-Bv for importer@patchew.org; Wed, 04 Dec 2019 04:44:22 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38550) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icR5W-0007CR-JP for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1icR5F-00009F-4e for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:35 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:54983 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1icR5E-0008MN-VN for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:33 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-276-fgS3jZSAOpC5LeaTSeIrqg-1; Wed, 04 Dec 2019 04:36:28 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3EC7EDC21 for ; Wed, 4 Dec 2019 09:36:27 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-134.ams2.redhat.com [10.36.116.134]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0F5031001B09 for ; Wed, 4 Dec 2019 09:36:27 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 8EE5411366D1; Wed, 4 Dec 2019 10:36:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575452189; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KAnozijQnJ7jZgrp+o4jADOZ48ZvoJvjxYWiOwhxZ0o=; b=hlh/5rYeW1fu6GWAw/9Nl/HGZlilHT69xd/ganiQl3ZoN31a6ZjnkeAftecvzndGWASfE+ k5sE41Q1Kar6GTqMEAYfxN1Y57ZDHhjPnH2ZGqw8ORS6RpRCQYobn6OOQvcKBMDCBwYsJ+ l1YJD1v/gbLwF2heZVXePagyYVZyv/M= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH v2 04/18] tests: Clean up initialization of Error *err variables Date: Wed, 4 Dec 2019 10:36:11 +0100 Message-Id: <20191204093625.14836-5-armbru@redhat.com> In-Reply-To: <20191204093625.14836-1-armbru@redhat.com> References: <20191204093625.14836-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: fgS3jZSAOpC5LeaTSeIrqg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Declaring a local Error *err without initializer looks suspicious. Fuse the declaration with the initialization to avoid that. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- tests/test-qobject-output-visitor.c | 8 ++++---- tests/test-string-output-visitor.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/test-qobject-output-visitor.c b/tests/test-qobject-outpu= t-visitor.c index 3e993e5ba8..d7761ebf84 100644 --- a/tests/test-qobject-output-visitor.c +++ b/tests/test-qobject-output-visitor.c @@ -145,10 +145,10 @@ static void test_visitor_out_enum_errors(TestOutputVi= sitorData *data, const void *unused) { EnumOne i, bad_values[] =3D { ENUM_ONE__MAX, -1 }; - Error *err; =20 for (i =3D 0; i < ARRAY_SIZE(bad_values) ; i++) { - err =3D NULL; + Error *err =3D NULL; + visit_type_EnumOne(data->ov, "unused", &bad_values[i], &err); error_free_or_abort(&err); visitor_reset(data); @@ -240,11 +240,11 @@ static void test_visitor_out_struct_errors(TestOutput= VisitorData *data, EnumOne bad_values[] =3D { ENUM_ONE__MAX, -1 }; UserDefOne u =3D {0}; UserDefOne *pu =3D &u; - Error *err; int i; =20 for (i =3D 0; i < ARRAY_SIZE(bad_values) ; i++) { - err =3D NULL; + Error *err =3D NULL; + u.has_enum1 =3D true; u.enum1 =3D bad_values[i]; visit_type_UserDefOne(data->ov, "unused", &pu, &err); diff --git a/tests/test-string-output-visitor.c b/tests/test-string-output-= visitor.c index 02766c0f65..1be1540767 100644 --- a/tests/test-string-output-visitor.c +++ b/tests/test-string-output-visitor.c @@ -207,10 +207,10 @@ static void test_visitor_out_enum_errors(TestOutputVi= sitorData *data, const void *unused) { EnumOne i, bad_values[] =3D { ENUM_ONE__MAX, -1 }; - Error *err; =20 for (i =3D 0; i < ARRAY_SIZE(bad_values) ; i++) { - err =3D NULL; + Error *err =3D NULL; + visit_type_EnumOne(data->ov, "unused", &bad_values[i], &err); error_free_or_abort(&err); } --=20 2.21.0 From nobody Mon May 20 06:18:24 2024 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; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1575457913; cv=none; d=zohomail.com; s=zohoarc; b=e656yJzSTrm6YLbgcqZr+yyw3XvOrk6+3OgkaVWfIO8m2Y1SsT3HjkHbTQQRZygO0KzOccDcFgdClcHo80+s/aNVlutJ5tFoIcSBrk5JwfSO7csphQ/wRtxbTPcmTA0Uh6bH6O63CeLfuSZLgtR7YT9vOtgUl5MqtwLtWxc+Eis= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575457913; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ck8YC4RtctXQY4XvFDhEnQzwtpi+SeKk9po2VZb4n6E=; b=YWCOIEoXJ9DrzNXa3RzQji82hJ+qbTTH7l1/XlMSPP+qtjFwGtVKr+Pm7fE0Jz5LwUcS5NcgLvG9x4pWiJMDUG88tpYBv+kIhiMcM9ZX3aq12akikef9K6OzzRzj0IKXaRlzpOzUI9+dJuXO+jJWu3JUBnIhm77IZlj6TT80/WI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass 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 1575457913903982.7732134968442; Wed, 4 Dec 2019 03:11:53 -0800 (PST) Received: from localhost ([::1]:36904 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icSZR-0003sl-IH for importer@patchew.org; Wed, 04 Dec 2019 06:11:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39016) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icR5Z-0007G6-H2 for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1icR5H-0000Hv-Gm for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:46 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:21013 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1icR5G-0008SZ-BB for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:35 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-286-eLUV5_UrMtuHeT-s4l1ing-1; Wed, 04 Dec 2019 04:36:29 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A7BD418543A2 for ; Wed, 4 Dec 2019 09:36:28 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-134.ams2.redhat.com [10.36.116.134]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7294A19C68; Wed, 4 Dec 2019 09:36:28 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 9243111366D5; Wed, 4 Dec 2019 10:36:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575452190; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ck8YC4RtctXQY4XvFDhEnQzwtpi+SeKk9po2VZb4n6E=; b=JMh31jnB4yrx8eUAhiDIdRLS3caH9BCaPxoYW1rRYu+RqA1Ye3aczEVJXUr+c2ath3IxAI lEEeNlers+xV95OvKD4VZPHvTZM7ADnnDm/x2ut7XiDsHOChKJND9zblLyWju1juCdCbcF dTq1zfg83eAkwgxWMjfCbIsMM/nkKEw= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH v2 05/18] exec: Fix file_ram_alloc() error API violations Date: Wed, 4 Dec 2019 10:36:12 +0100 Message-Id: <20191204093625.14836-6-armbru@redhat.com> In-Reply-To: <20191204093625.14836-1-armbru@redhat.com> References: <20191204093625.14836-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: eLUV5_UrMtuHeT-s4l1ing-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 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: Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" When os_mem_prealloc() fails, file_ram_alloc() calls qemu_ram_munmap() and returns null. Except it doesn't when its @errp argument is null, because it checks for failure with (errp && *errp). Introduced in commit 056b68af77 "fix qemu exit on memory hotplug when allocation fails at prealloc time". No caller actually passes null. Fix anyway: splice in a local Error *err, and error_propagate(). Cc: Igor Mammedov Signed-off-by: Markus Armbruster Reviewed-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- exec.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/exec.c b/exec.c index ffdb518535..45695a5f2d 100644 --- a/exec.c +++ b/exec.c @@ -1841,6 +1841,7 @@ static void *file_ram_alloc(RAMBlock *block, bool truncate, Error **errp) { + Error *err =3D NULL; MachineState *ms =3D MACHINE(qdev_get_machine()); void *area; =20 @@ -1898,8 +1899,9 @@ static void *file_ram_alloc(RAMBlock *block, } =20 if (mem_prealloc) { - os_mem_prealloc(fd, area, memory, ms->smp.cpus, errp); - if (errp && *errp) { + os_mem_prealloc(fd, area, memory, ms->smp.cpus, &err); + if (err) { + error_propagate(errp, err); qemu_ram_munmap(fd, area, memory); return NULL; } --=20 2.21.0 From nobody Mon May 20 06:18:24 2024 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; dkim=fail; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1575453393; cv=none; d=zohomail.com; s=zohoarc; b=nycMb4XiWJdUSjJ2fId2fNe3FKmQJHuBuRfuUR3SbH5To7bTGcNJ2oJFE0xwkoo3n+m6A+ooxoGibEm3YU2KQdSlc+S6jKvpBzxUwTzX8PDD8VJ+KkPP6F5OSC3x1AC9NI9JrbxxpYNY9Jzc0rDHN7RDEPtoRZw0Hpdj1rNpY0A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575453393; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=eNZoyFYgA/aKwuSgWEKLFPIR/VOAmutzfJxKqf7RMFw=; b=ETbUH/EZNgywyamRZIfP2fLWjHpBMgR9tRbzcMjiIOhOu2px6sp4dGTTdjFO79gshzfQjadLduJ3kn75Uk4OhR8nypRvgB++p2vSUe/poG7vZHyxgZRusNF+Yhcw8PGzibB30AVUUtTUySU9v9X6YrOra5mGaCKv33qX6C3jfR0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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 1575453393587148.06060640677526; Wed, 4 Dec 2019 01:56:33 -0800 (PST) Received: from localhost ([::1]:36324 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icROY-0005Fl-7j for importer@patchew.org; Wed, 04 Dec 2019 04:56:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38697) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icR5Q-0007De-UK for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1icR5J-0000S0-N8 for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:39 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:59931 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1icR5J-00009j-Hy for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:37 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-184-gNVdFu32OQGLAmDUoyTh7g-1; Wed, 04 Dec 2019 04:36:32 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 30CFC18543A1 for ; Wed, 4 Dec 2019 09:36:31 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-134.ams2.redhat.com [10.36.116.134]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 721F65D6AE; Wed, 4 Dec 2019 09:36:28 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 9586C11366DB; Wed, 4 Dec 2019 10:36:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575452193; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eNZoyFYgA/aKwuSgWEKLFPIR/VOAmutzfJxKqf7RMFw=; b=EEP3peeavoa68rI6rilk0oqtoSDQG2UAABAOhpAkhFv3kIAb0+uLhPe5G4ohC9FCufd8gG qd/+2RjzHwugkhGyDJHefXE2mSRLkiw9Ce7EKH5x4TBbv/6RNtvBZ9Meqqg61sv7HYJpDe TifFDPeMBN4dt7FlqiWUcj68RLMuMhU= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH v2 06/18] hw/acpi: Fix legacy CPU plug error API violations Date: Wed, 4 Dec 2019 10:36:13 +0100 Message-Id: <20191204093625.14836-7-armbru@redhat.com> In-Reply-To: <20191204093625.14836-1-armbru@redhat.com> References: <20191204093625.14836-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: gNVdFu32OQGLAmDUoyTh7g-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 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: Igor Mammedov , "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" legacy_acpi_cpu_plug_cb() dereferences @errp when acpi_set_cpu_present_bit() fails. That's wrong; see the big comment in error.h. Introduced in commit cc43364de7 "acpi/cpu-hotplug: introduce helper function to keep bit setting in one place". No caller actually passes null, and acpi_set_cpu_present_bit() can't actually fail. Fix anyway: drop acpi_set_cpu_present_bit()'s @errp parameter. Cc: "Michael S. Tsirkin" Cc: Igor Mammedov Signed-off-by: Markus Armbruster Reviewed-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin --- hw/acpi/cpu_hotplug.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/hw/acpi/cpu_hotplug.c b/hw/acpi/cpu_hotplug.c index 3ac2045a95..9c3bcc84de 100644 --- a/hw/acpi/cpu_hotplug.c +++ b/hw/acpi/cpu_hotplug.c @@ -55,8 +55,7 @@ static const MemoryRegionOps AcpiCpuHotplug_ops =3D { }, }; =20 -static void acpi_set_cpu_present_bit(AcpiCpuHotplug *g, CPUState *cpu, - Error **errp) +static void acpi_set_cpu_present_bit(AcpiCpuHotplug *g, CPUState *cpu) { CPUClass *k =3D CPU_GET_CLASS(cpu); int64_t cpu_id; @@ -74,10 +73,7 @@ static void acpi_set_cpu_present_bit(AcpiCpuHotplug *g, = CPUState *cpu, void legacy_acpi_cpu_plug_cb(HotplugHandler *hotplug_dev, AcpiCpuHotplug *g, DeviceState *dev, Error **= errp) { - acpi_set_cpu_present_bit(g, CPU(dev), errp); - if (*errp !=3D NULL) { - return; - } + acpi_set_cpu_present_bit(g, CPU(dev)); acpi_send_event(DEVICE(hotplug_dev), ACPI_CPU_HOTPLUG_STATUS); } =20 @@ -92,7 +88,7 @@ void legacy_acpi_cpu_hotplug_init(MemoryRegion *parent, O= bject *owner, gpe_cpu->device =3D owner; =20 CPU_FOREACH(cpu) { - acpi_set_cpu_present_bit(gpe_cpu, cpu, &error_abort); + acpi_set_cpu_present_bit(gpe_cpu, cpu); } } =20 --=20 2.21.0 From nobody Mon May 20 06:18:24 2024 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; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1575455668; cv=none; d=zohomail.com; s=zohoarc; b=bDD8Q067DM1FO5Yba3lVaFzJ1nEZFXOEoJLBXDVO/HAbNUM9kBfdRZkKfb933mMjZVyKlwJ37thHeIJFqJmPM/VcceG1KvLbVntmfh4/3YkDeVS6ROcZ4HBHQv+WUbbCi410Cl0gIWPEetd6qFLShF1AUBdoqEPbtsdPQ0jfs8Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575455668; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=qt7qBgRXYhoBRK/lPeVpvCp1AuGz4zh1UbVQfAOPcQ0=; b=NCiMRwDec6VspxwmLCh1XwX/DQvFYGjIc0g9NTSiwQ6s5y4jYwe/hJh5cvm1KG4n4l4sJXsdcCs1Rjf7M3uW+YEYNfwCe6ejwf1wVAOLOEtd0nLw8LVRY01Q4g68qpGSh1AgBP4Q1Vd/5JG8KQBVCVmizrNGfn+78H5wmnJ38O8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass 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 1575455668902369.1557478754937; Wed, 4 Dec 2019 02:34:28 -0800 (PST) Received: from localhost ([::1]:36586 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icRzH-0003b7-V0 for importer@patchew.org; Wed, 04 Dec 2019 05:34:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38640) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icR5T-0007DC-NM for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1icR5I-0000MB-Hk for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:38 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:56174 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1icR5H-0008RY-8E for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:36 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-298-x70HgSxxMCC-9t5ZNuCpoA-1; Wed, 04 Dec 2019 04:36:29 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A367B100550E for ; Wed, 4 Dec 2019 09:36:28 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-134.ams2.redhat.com [10.36.116.134]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 73A2A5D6B7 for ; Wed, 4 Dec 2019 09:36:28 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 98B5311366DF; Wed, 4 Dec 2019 10:36:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575452190; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qt7qBgRXYhoBRK/lPeVpvCp1AuGz4zh1UbVQfAOPcQ0=; b=FPNoEvEINRbcugiawStgrMnyaTfM642xzzc03DtKq4JfIP38pEI7w8c3IxNdfXs7CYyQhS KdHQMw9uQxisoY9gcTDOwKDJZSCV5tDsl3K7HJlHL2yb3Mi1ufFFfw28IQVaigkxrk+oCo G2MMAddOib/w0jHpusIt/6C2+Rcs0XM= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH v2 07/18] hw/core: Fix fit_load_fdt() error handling violations Date: Wed, 4 Dec 2019 10:36:14 +0100 Message-Id: <20191204093625.14836-8-armbru@redhat.com> In-Reply-To: <20191204093625.14836-1-armbru@redhat.com> References: <20191204093625.14836-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: x70HgSxxMCC-9t5ZNuCpoA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" fit_load_fdt() passes @errp to fit_image_addr(), then recovers from ENOENT failures. Passing @errp is wrong, because it works only as long as @errp is neither @error_fatal nor @error_abort. Messed up in commit 3eb99edb48 "loader-fit: Wean off error_printf()". No caller actually passes such values. Fix anyway: splice in a local Error *err, and error_propagate(). Signed-off-by: Markus Armbruster Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/core/loader-fit.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/hw/core/loader-fit.c b/hw/core/loader-fit.c index 953b16bc82..c465921b8f 100644 --- a/hw/core/loader-fit.c +++ b/hw/core/loader-fit.c @@ -178,11 +178,12 @@ static int fit_load_fdt(const struct fit_loader *ldr,= const void *itb, int cfg, void *opaque, const void *match_data, hwaddr kernel_end, Error **errp) { + Error *err =3D NULL; const char *name; const void *data; const void *load_data; hwaddr load_addr; - int img_off, err; + int img_off; size_t sz; int ret; =20 @@ -197,13 +198,13 @@ static int fit_load_fdt(const struct fit_loader *ldr,= const void *itb, return -EINVAL; } =20 - err =3D fit_image_addr(itb, img_off, "load", &load_addr, errp); - if (err =3D=3D -ENOENT) { + ret =3D fit_image_addr(itb, img_off, "load", &load_addr, &err); + if (ret =3D=3D -ENOENT) { load_addr =3D ROUND_UP(kernel_end, 64 * KiB) + (10 * MiB); - error_free(*errp); - } else if (err) { - error_prepend(errp, "unable to read FDT load address from FIT: "); - ret =3D err; + error_free(err); + } else if (ret) { + error_propagate_prepend(errp, err, + "unable to read FDT load address from FIT:= "); goto out; } =20 --=20 2.21.0 From nobody Mon May 20 06:18:24 2024 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; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1575455525; cv=none; d=zohomail.com; s=zohoarc; b=FD+Vl2ynMzL25iuC4NV7o9awfic9qFps35PUjZ6uYTpW0hbWkhUj5DiBMkhPVSwE3u4PmkgHXE8PnxanhE1CwQawV6x+xKrkS+LqXVOv4s/t9iXcglU0y+vKRpSy7RAelFwsWp+AOiZsw13AQdzwjRDWo/vZE5DWT7X78/13Q8k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575455525; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0bvQfoeL+pOk808cYwQqixdYAIeBL4wm+BDa+63MsU8=; b=BQ/N52k8/qHZ/o8ttiw8eQx8gyixgWAwa+AuehxPOveDzcAJPOA9jrKkCtYjAk2c3Z+cIXOvfeHsOz8XG+G8e9PFxpAFEZKKK3unIA0ExpIXgJ3H8eSEQ3mtr+pTkJV0RXVW0l+XLQWKvieo7yPRmx9QvRn0kBCA+kVv+S25cMM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass 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 15754555256467.265165786233069; Wed, 4 Dec 2019 02:32:05 -0800 (PST) Received: from localhost ([::1]:36552 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icRwt-0001xI-5Y for importer@patchew.org; Wed, 04 Dec 2019 05:31:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39007) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icR5W-0007G1-DL for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1icR5K-0000W5-My for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:46 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:46756 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1icR5K-00008m-Hk for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:38 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-286-CEzWJV9kPje4pvNO4jMHig-1; Wed, 04 Dec 2019 04:36:29 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AB633107ACC7; Wed, 4 Dec 2019 09:36:28 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-134.ams2.redhat.com [10.36.116.134]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7A2B469184; Wed, 4 Dec 2019 09:36:28 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 9BFC711366E6; Wed, 4 Dec 2019 10:36:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575452192; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0bvQfoeL+pOk808cYwQqixdYAIeBL4wm+BDa+63MsU8=; b=FoI+JLqnthJ4nND9ryffaG/b5wsy8guCQjNcp/QwAuKRfpapwtubBKhvz8leeZ60vdj3ds 6Iq0lj+gelbWEvoZRzi2N4UYnLSf4K4KeTTsAA950R2iOcEKjzcSAzbk3+5akru8bqY7rW 7vRLvVLBuDZ+6zSrvX8mJYOVtynIC10= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH v2 08/18] hw/ipmi: Fix realize() error API violations Date: Wed, 4 Dec 2019 10:36:15 +0100 Message-Id: <20191204093625.14836-9-armbru@redhat.com> In-Reply-To: <20191204093625.14836-1-armbru@redhat.com> References: <20191204093625.14836-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: CEzWJV9kPje4pvNO4jMHig-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 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: Corey Minyard Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" isa_ipmi_bt_realize(), ipmi_isa_realize(), pci_ipmi_bt_realize(), and pci_ipmi_kcs_realize() dereference @errp when IPMIInterfaceClass method init() fails. That's wrong; see the big comment in error.h. Introduced in commit 0719029c47 "ipmi: Add an ISA KCS low-level interface", then imitated in commit a9b74079cb "ipmi: Add a BT low-level interface" and commit 12f983c6aa "ipmi: Add PCI IPMI interfaces". No caller actually passes null. Fix anyway: splice in a local Error *err, and error_propagate(). Cc: Corey Minyard Signed-off-by: Markus Armbruster --- hw/ipmi/isa_ipmi_bt.c | 7 +++++-- hw/ipmi/isa_ipmi_kcs.c | 7 +++++-- hw/ipmi/pci_ipmi_bt.c | 6 ++++-- hw/ipmi/pci_ipmi_kcs.c | 6 ++++-- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/hw/ipmi/isa_ipmi_bt.c b/hw/ipmi/isa_ipmi_bt.c index 9a87ffd3f0..9fba5ed383 100644 --- a/hw/ipmi/isa_ipmi_bt.c +++ b/hw/ipmi/isa_ipmi_bt.c @@ -70,6 +70,7 @@ static void isa_ipmi_bt_lower_irq(IPMIBT *ib) =20 static void isa_ipmi_bt_realize(DeviceState *dev, Error **errp) { + Error *err =3D NULL; ISADevice *isadev =3D ISA_DEVICE(dev); ISAIPMIBTDevice *iib =3D ISA_IPMI_BT(dev); IPMIInterface *ii =3D IPMI_INTERFACE(dev); @@ -85,9 +86,11 @@ static void isa_ipmi_bt_realize(DeviceState *dev, Error = **errp) iib->bt.bmc->intf =3D ii; iib->bt.opaque =3D iib; =20 - iic->init(ii, 0, errp); - if (*errp) + iic->init(ii, 0, &err); + if (err) { + error_propagate(errp, err); return; + } =20 if (iib->isairq > 0) { isa_init_irq(isadev, &iib->irq, iib->isairq); diff --git a/hw/ipmi/isa_ipmi_kcs.c b/hw/ipmi/isa_ipmi_kcs.c index ca3ea36a3f..cc6bd817f2 100644 --- a/hw/ipmi/isa_ipmi_kcs.c +++ b/hw/ipmi/isa_ipmi_kcs.c @@ -69,6 +69,7 @@ static void isa_ipmi_kcs_lower_irq(IPMIKCS *ik) =20 static void ipmi_isa_realize(DeviceState *dev, Error **errp) { + Error *err =3D NULL; ISADevice *isadev =3D ISA_DEVICE(dev); ISAIPMIKCSDevice *iik =3D ISA_IPMI_KCS(dev); IPMIInterface *ii =3D IPMI_INTERFACE(dev); @@ -84,9 +85,11 @@ static void ipmi_isa_realize(DeviceState *dev, Error **e= rrp) iik->kcs.bmc->intf =3D ii; iik->kcs.opaque =3D iik; =20 - iic->init(ii, 0, errp); - if (*errp) + iic->init(ii, 0, &err); + if (err) { + error_propagate(errp, err); return; + } =20 if (iik->isairq > 0) { isa_init_irq(isadev, &iik->irq, iik->isairq); diff --git a/hw/ipmi/pci_ipmi_bt.c b/hw/ipmi/pci_ipmi_bt.c index 6ed925a665..ba9cf016b5 100644 --- a/hw/ipmi/pci_ipmi_bt.c +++ b/hw/ipmi/pci_ipmi_bt.c @@ -54,6 +54,7 @@ static void pci_ipmi_lower_irq(IPMIBT *ik) =20 static void pci_ipmi_bt_realize(PCIDevice *pd, Error **errp) { + Error *err =3D NULL; PCIIPMIBTDevice *pik =3D PCI_IPMI_BT(pd); IPMIInterface *ii =3D IPMI_INTERFACE(pd); IPMIInterfaceClass *iic =3D IPMI_INTERFACE_GET_CLASS(ii); @@ -74,8 +75,9 @@ static void pci_ipmi_bt_realize(PCIDevice *pd, Error **er= rp) pik->bt.raise_irq =3D pci_ipmi_raise_irq; pik->bt.lower_irq =3D pci_ipmi_lower_irq; =20 - iic->init(ii, 8, errp); - if (*errp) { + iic->init(ii, 8, &err); + if (err) { + error_propagate(errp, err); return; } pci_register_bar(pd, 0, PCI_BASE_ADDRESS_SPACE_IO, &pik->bt.io); diff --git a/hw/ipmi/pci_ipmi_kcs.c b/hw/ipmi/pci_ipmi_kcs.c index eeba63baa4..99f46152f4 100644 --- a/hw/ipmi/pci_ipmi_kcs.c +++ b/hw/ipmi/pci_ipmi_kcs.c @@ -54,6 +54,7 @@ static void pci_ipmi_lower_irq(IPMIKCS *ik) =20 static void pci_ipmi_kcs_realize(PCIDevice *pd, Error **errp) { + Error *err =3D NULL; PCIIPMIKCSDevice *pik =3D PCI_IPMI_KCS(pd); IPMIInterface *ii =3D IPMI_INTERFACE(pd); IPMIInterfaceClass *iic =3D IPMI_INTERFACE_GET_CLASS(ii); @@ -74,8 +75,9 @@ static void pci_ipmi_kcs_realize(PCIDevice *pd, Error **e= rrp) pik->kcs.raise_irq =3D pci_ipmi_raise_irq; pik->kcs.lower_irq =3D pci_ipmi_lower_irq; =20 - iic->init(ii, 8, errp); - if (*errp) { + iic->init(ii, 8, &err); + if (err) { + error_propagate(errp, err); return; } pci_register_bar(pd, 0, PCI_BASE_ADDRESS_SPACE_IO, &pik->kcs.io); --=20 2.21.0 From nobody Mon May 20 06:18:24 2024 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; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1575453859; cv=none; d=zohomail.com; s=zohoarc; b=CU/EXY91kFPpYtYeN6pFzrnJNOyzikFqsU0dkLdTe50CKU0UWQl5bAaQZm6X5PSM2IufnpvzgYPdkNf/P6UVG+MKsEi1D8BdAxW8bkmbjgLomNPqze7d9rqbGpQWRdd8KLSUqLsPz9t+i+t++mryAjmn4cse+KEO5+ATd52T0ZI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575453859; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=wnj3Sj68Rnwm5t5oQgKpqk1Jaf8yn00PjmYAUZD4nCw=; b=fnL8P5Tu6YU2ZzwwmckEcJGpQwCWfAqt1IoX0ezP7OfCBJKtY7JC68Re5mGUPnhrx6/WanfCR+mX2I+J6FmEa+tpdnkTfn1bC88VERuaYlfQRCc3HoehiNIU/gLv5VxdJ3Z5/pGASGqzLJC/gZj891oNMSq4pIMcVn5BgyTWDHI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass 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 1575453859868832.4325300400527; Wed, 4 Dec 2019 02:04:19 -0800 (PST) Received: from localhost ([::1]:36386 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icRW0-00082q-Uo for importer@patchew.org; Wed, 04 Dec 2019 05:04:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38556) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icR5O-0007CT-L4 for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1icR5G-0000F3-K3 for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:36 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:32763 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1icR5G-0008Sd-Fp for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:34 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-380-d68Brm6NMBWc3rtNZ6UJcg-1; Wed, 04 Dec 2019 04:36:29 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A5899800D5B; Wed, 4 Dec 2019 09:36:28 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-134.ams2.redhat.com [10.36.116.134]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 770BF600CD; Wed, 4 Dec 2019 09:36:28 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 9F26A11366EC; Wed, 4 Dec 2019 10:36:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575452190; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wnj3Sj68Rnwm5t5oQgKpqk1Jaf8yn00PjmYAUZD4nCw=; b=EkkTPvNB4vUzFFhfuBFk74gRzTm/Tc6+NY5OjafbzDQBLqkJC8iXTVvPIfJ9C9YomYCYiK HgXcKeYg0QtC/xd3nXcK7QOx9/2StBYev3pwK+8RxuCAEali72AIefTPd1RLR+pDFFHydQ fkKn+rbG+KHohNRaww4cveTML7mbYNo= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH v2 09/18] qga: Fix guest-get-fsinfo error API violations Date: Wed, 4 Dec 2019 10:36:16 +0100 Message-Id: <20191204093625.14836-10-armbru@redhat.com> In-Reply-To: <20191204093625.14836-1-armbru@redhat.com> References: <20191204093625.14836-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: d68Brm6NMBWc3rtNZ6UJcg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 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: Michael Roth Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" build_guest_fsinfo_for_virtual_device() dereferences @errp when build_guest_fsinfo_for_device() fails. That's wrong; see the big comment in error.h. Introduced in commit 46d4c5723e "qga: Add guest-get-fsinfo command". No caller actually passes null. Fix anyway: splice in a local Error *err, and error_propagate(). Cc: Michael Roth Signed-off-by: Markus Armbruster Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- qga/commands-posix.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/qga/commands-posix.c b/qga/commands-posix.c index 1c1a165dae..0be527ccb8 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -1049,6 +1049,7 @@ static void build_guest_fsinfo_for_virtual_device(cha= r const *syspath, GuestFilesystemInfo *fs, Error **errp) { + Error *err =3D NULL; DIR *dir; char *dirpath; struct dirent *entry; @@ -1078,10 +1079,11 @@ static void build_guest_fsinfo_for_virtual_device(c= har const *syspath, =20 g_debug(" slave device '%s'", entry->d_name); path =3D g_strdup_printf("%s/slaves/%s", syspath, entry->d_nam= e); - build_guest_fsinfo_for_device(path, fs, errp); + build_guest_fsinfo_for_device(path, fs, &err); g_free(path); =20 - if (*errp) { + if (err) { + error_propagate(errp, err); break; } } --=20 2.21.0 From nobody Mon May 20 06:18:24 2024 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; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1575455058; cv=none; d=zohomail.com; s=zohoarc; b=OQgp22kF/9u/2YcGNy4Z9gwrW7uKvRa0M2GHrvPmfRrj6MWjgf62vSNrvbhAqKFtDbVTprf+PWqQqqv8fHuA2CaRZB6+MjeotstlfxodCC0Z3qLrbPbhcoNVVQPPDXZM5dOHK+y6HDvn/fN1cMTMNKilEGvVs1PWrGDI3uCmHRo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575455058; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Td6VxE5zTmUsHVwy0M3hGHsHlUZ8X6ahEXJQ6lgxe2c=; b=CEtW54mKNu99kECvmU/tBylhbhDFgzvjz87/g1mxfL34qGKh1+YzC3FEpkz3SMU1uZ7IquwlZynKvwZd6300HySLbUTQ6JMrLiX5I38dl63uj9jHwoKm81he17NNNPLWBYFHhPqTG93flPDgz9XmkqITQ7UkzUL05zId6xfJMcE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass 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 1575455058586698.5711740817202; Wed, 4 Dec 2019 02:24:18 -0800 (PST) Received: from localhost ([::1]:36516 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icRpN-0007g4-8x for importer@patchew.org; Wed, 04 Dec 2019 05:24:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38825) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icR5T-0007El-8q for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1icR5M-0000bA-4z for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:43 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:35094 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1icR5L-0000Ie-W5 for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:40 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-134-O3QRq4KFMOqawDMg_zAnmA-1; Wed, 04 Dec 2019 04:36:34 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 77357DC20 for ; Wed, 4 Dec 2019 09:36:33 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-134.ams2.redhat.com [10.36.116.134]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 796FA5DA60; Wed, 4 Dec 2019 09:36:28 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id A250911366F1; Wed, 4 Dec 2019 10:36:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575452195; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Td6VxE5zTmUsHVwy0M3hGHsHlUZ8X6ahEXJQ6lgxe2c=; b=d8b4wE+hq7Y3Hrnu3CD9qxjovRlBhQ3kJHf2N0uxDFxEyrLm6p+G0x46kiaBHsVdGy+uBq 5zsY2Wv8e4RuS6qw9Syds7i1HvHcXg80FuBKqDfrJ417/AsqFDAhHzOvLfXuGVbRAsOfyh 7PA7qP3QS1nfhF5F5EMqJN0Y4nXHRL8= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH v2 10/18] memory-device: Fix memory pre-plug error API violations Date: Wed, 4 Dec 2019 10:36:17 +0100 Message-Id: <20191204093625.14836-11-armbru@redhat.com> In-Reply-To: <20191204093625.14836-1-armbru@redhat.com> References: <20191204093625.14836-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: O3QRq4KFMOqawDMg_zAnmA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 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: David Hildenbrand Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" memory_device_get_free_addr() dereferences @errp when memory_device_check_addable() fails. That's wrong; see the big comment in error.h. Introduced in commit 1b6d6af21b "pc-dimm: factor out capacity and slot checks into MemoryDevice". No caller actually passes null. Fix anyway: splice in a local Error *err, and error_propagate(). Cc: David Hildenbrand Signed-off-by: Markus Armbruster Reviewed-by: David Hildenbrand --- hw/mem/memory-device.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/mem/memory-device.c b/hw/mem/memory-device.c index aef148c1d7..4bc9cf0917 100644 --- a/hw/mem/memory-device.c +++ b/hw/mem/memory-device.c @@ -99,6 +99,7 @@ static uint64_t memory_device_get_free_addr(MachineState = *ms, uint64_t align, uint64_t size, Error **errp) { + Error *err =3D NULL; GSList *list =3D NULL, *item; Range as, new =3D range_empty; =20 @@ -123,8 +124,9 @@ static uint64_t memory_device_get_free_addr(MachineStat= e *ms, return 0; } =20 - memory_device_check_addable(ms, size, errp); - if (*errp) { + memory_device_check_addable(ms, size, &err); + if (err) { + error_propagate(errp, err); return 0; } =20 --=20 2.21.0 From nobody Mon May 20 06:18:24 2024 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; dkim=fail; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1575456432; cv=none; d=zohomail.com; s=zohoarc; b=SddxAGvx4v0alRglszxCCuKPNU84RUzTlnyF3NRgUjpPOc/Kub/DiWWjQ1rpJYjgcP08oOh3KUs9IYuV0XeEhEjJRaRDPV8ZIJcq3IUkwVt7Qq1kbvtycGgLaRuXlZA/qfHcGH9LfViqQqWZeLPyuZV7ofO5Q7MMPeisBR6es8w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575456432; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=xptOCNnsIHKHFrFX5zqteF/m5AlNBeqPE8IAUUchUhE=; b=UyH9htZT/DcVvQ12gisOEdK3i2q4ZO5lEIsEHBZTjroqFMjLgfRrtapxWGDEDsldlEUgW9xQ2v4qyTQCuGIdHfY3RQzyK4NA2aPEXypLoOB9n/DQy563RI+rJDIkOLI/tZhV1JwqbyG+bp+VLTCi5rGy6dIPRmaYYoOi7qh2olI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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 1575456432654763.1808350995442; Wed, 4 Dec 2019 02:47:12 -0800 (PST) Received: from localhost ([::1]:36694 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icSBY-00032I-EO for importer@patchew.org; Wed, 04 Dec 2019 05:47:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38920) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icR5W-0007FB-R0 for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1icR5L-0000Yg-E8 for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:42 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:33316 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1icR5L-0000BO-9X for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:39 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-106-agi402gYNLGVclUIkciM9A-1; Wed, 04 Dec 2019 04:36:31 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 240F7800D54 for ; Wed, 4 Dec 2019 09:36:31 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-134.ams2.redhat.com [10.36.116.134]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 813511001925; Wed, 4 Dec 2019 09:36:28 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id A58C511366F2; Wed, 4 Dec 2019 10:36:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575452193; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xptOCNnsIHKHFrFX5zqteF/m5AlNBeqPE8IAUUchUhE=; b=fAbN+Wu89nVoghJF+/Q2v8NrzxCZNVAGN9rVUmmRLQf6F69O3BV9IuBkfpyw0zPnXlxAf8 laP3u7mPppUy5FIQBKEFWh2U4/Wjtac6K1oNZlIwBOnZkp8N7bxImP6fpUh9nFuxDsybol elWCD0VAfN6wu35lB/VgsG2Lz9JIRtM= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH v2 11/18] s390x/event-facility: Fix realize() error API violations Date: Wed, 4 Dec 2019 10:36:18 +0100 Message-Id: <20191204093625.14836-12-armbru@redhat.com> In-Reply-To: <20191204093625.14836-1-armbru@redhat.com> References: <20191204093625.14836-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: agi402gYNLGVclUIkciM9A-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 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: Cornelia Huck , David Hildenbrand Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" sclp_events_bus_realize() dereferences @errp when object_property_set_bool() fails. That's wrong; see the big comment in error.h. Introduced in commit f6102c329c "s390/sclp: rework sclp event facility initialization + device realization". No caller actually passes null. Fix anyway: splice in a local Error *err, and error_propagate(). Cc: David Hildenbrand Cc: Cornelia Huck Signed-off-by: Markus Armbruster Reviewed-by: David Hildenbrand --- hw/s390x/event-facility.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/s390x/event-facility.c b/hw/s390x/event-facility.c index 66205697ae..cdcf9154c4 100644 --- a/hw/s390x/event-facility.c +++ b/hw/s390x/event-facility.c @@ -339,14 +339,16 @@ out: =20 static void sclp_events_bus_realize(BusState *bus, Error **errp) { + Error *err =3D NULL; BusChild *kid; =20 /* TODO: recursive realization has to be done in common code */ QTAILQ_FOREACH(kid, &bus->children, sibling) { DeviceState *dev =3D kid->child; =20 - object_property_set_bool(OBJECT(dev), true, "realized", errp); - if (*errp) { + object_property_set_bool(OBJECT(dev), true, "realized", &err); + if (errp) { + error_propagate(errp, err); return; } } --=20 2.21.0 From nobody Mon May 20 06:18:24 2024 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; dkim=fail; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1575455658; cv=none; d=zohomail.com; s=zohoarc; b=XGe/O5yNo1K0AQjqXuHQMT1xJ+TMI99RPQ1jFnAn/qakTC50/Kg7hNZ0GnGud2bHKauCherNE5/JiL8uRttaulC2nRywfw8WgdlV6Pe0eISIxGl6p3BQtgrrVXkjbs/wLi2i4GRqW1KeQE4sbXttHMbJUr0NRRToKZSgZVMwCl8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575455658; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1cWosWeT2TZOK6LwSZ56SM2lpIU6/+dPaDq6QV9nsFw=; b=GrcPM1uuh1X9pWOlA/ZTOLijdTp6e4anb00igBXk0HyHsxEGxsfOAc77s3PIURNVEVIV8piFUrKdlKP3NUYSgwbBX/qwzhgBGP1eOSFy7Bc6EaVjRtgfjd3aZ8QIfDbtrddhWIyG2qR1pIeTo8zcAMy/w1zSWYbLHWtpLsI/c1k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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 1575455658915345.65721420787384; Wed, 4 Dec 2019 02:34:18 -0800 (PST) Received: from localhost ([::1]:36580 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icRz5-0003VI-PY for importer@patchew.org; Wed, 04 Dec 2019 05:34:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39144) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icR5l-0007IO-1k for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:37:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1icR5P-0000mM-8l for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:53 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:49190 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1icR5P-0000WT-3V for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:43 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-62-KP3NdkBDO0Kp0ZNRA6CUHA-1; Wed, 04 Dec 2019 04:36:32 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A024BDC21 for ; Wed, 4 Dec 2019 09:36:31 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-134.ams2.redhat.com [10.36.116.134]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 80BCD19C69; Wed, 4 Dec 2019 09:36:28 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id A8BE411366F3; Wed, 4 Dec 2019 10:36:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575452198; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1cWosWeT2TZOK6LwSZ56SM2lpIU6/+dPaDq6QV9nsFw=; b=eksR6aFloddx596T4v8SkYSEJCK7XZC1dMAgiNnmrjAtByPZ+RXu9RC8XQiMM0B48f5U4W o+hFFhjLKtJqDAtAh5Sy1Rj/vAcoHoppULR6+LUHLXsxWOObuCVNJpV8N63874kkJNlga7 qLLuPRMhDiI+hLE7pMDR0LmVIJdztg8= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH v2 12/18] s390x/cpumodel: Fix feature property error API violations Date: Wed, 4 Dec 2019 10:36:19 +0100 Message-Id: <20191204093625.14836-13-armbru@redhat.com> In-Reply-To: <20191204093625.14836-1-armbru@redhat.com> References: <20191204093625.14836-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: KP3NdkBDO0Kp0ZNRA6CUHA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 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: Cornelia Huck , David Hildenbrand Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" s390x-cpu property setters set_feature() and set_feature_group() dereference @errp when the visitor fails. That's wrong; see the big comment in error.h. Introduced in commit 0754f60429 "s390x/cpumodel: expose features and feature groups as properties". No caller actually passes null. Fix anyway: splice in a local Error *err, and error_propagate(). Cc: David Hildenbrand Cc: Cornelia Huck Signed-off-by: Markus Armbruster Reviewed-by: David Hildenbrand --- target/s390x/cpu_models.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c index 7e92fb2e15..6a29fd3ab1 100644 --- a/target/s390x/cpu_models.c +++ b/target/s390x/cpu_models.c @@ -987,6 +987,7 @@ static void get_feature(Object *obj, Visitor *v, const = char *name, static void set_feature(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { + Error *err =3D NULL; S390Feat feat =3D (S390Feat) opaque; DeviceState *dev =3D DEVICE(obj); S390CPU *cpu =3D S390_CPU(obj); @@ -1002,8 +1003,9 @@ static void set_feature(Object *obj, Visitor *v, cons= t char *name, return; } =20 - visit_type_bool(v, name, &value, errp); - if (*errp) { + visit_type_bool(v, name, &value, &err); + if (err) { + error_propagate(errp, err); return; } if (value) { @@ -1043,6 +1045,7 @@ static void get_feature_group(Object *obj, Visitor *v= , const char *name, static void set_feature_group(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { + Error *err =3D NULL; S390FeatGroup group =3D (S390FeatGroup) opaque; const S390FeatGroupDef *def =3D s390_feat_group_def(group); DeviceState *dev =3D DEVICE(obj); @@ -1059,8 +1062,9 @@ static void set_feature_group(Object *obj, Visitor *v= , const char *name, return; } =20 - visit_type_bool(v, name, &value, errp); - if (*errp) { + visit_type_bool(v, name, &value, &err); + if (err) { + error_propagate(errp, err); return; } if (value) { --=20 2.21.0 From nobody Mon May 20 06:18:24 2024 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; dkim=fail; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1575455251; cv=none; d=zohomail.com; s=zohoarc; b=XzUFAieoc6C/gXGNZpCgXHrMNR1WSEqovz8wU4Sr1q3SY9ibcp1NbBQsZMQSi4S0aOh7iECKpXgsccTmoAP8ldV9AaGkWq73YMQHw2FF3paQbDcRX9TjFD4DYteZdblge0kSO4NwPd0NkijwCM3Ez3ze4DtcmtO9vUa822OpL64= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575455251; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=P4RnQPlmqBzcfDiHCZteURy6me1QA9GlGCFi3SGCF9k=; b=JO2SzddTnEjm2lQ3b28WlFWFg71Xp/vfWf3iiXhUS9SFBfj9Zs0LqA1HF1YGEYsKS87WsxV1JR+J9sX28uH3J256e4EQZ45Qv3VcZe+pjlAXXDDecOczZp73au39RprjUItIzxcKhveaJ6EbvRkY1DbeMfLKuk11eFn2Pn3JHVM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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 1575455251884772.1649103573; Wed, 4 Dec 2019 02:27:31 -0800 (PST) Received: from localhost ([::1]:36528 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icRsV-0000NY-6z for importer@patchew.org; Wed, 04 Dec 2019 05:27:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38834) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icR5W-0007Ep-E7 for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1icR5M-0000bs-AY for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:43 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:23553 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1icR5M-0000Bn-5W for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:40 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-350--IX65pduNGO0Rz91j0-3TA-1; Wed, 04 Dec 2019 04:36:32 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9FE6F800D5B for ; Wed, 4 Dec 2019 09:36:31 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-134.ams2.redhat.com [10.36.116.134]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DDF1219C68; Wed, 4 Dec 2019 09:36:29 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id AC0F211366F7; Wed, 4 Dec 2019 10:36:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575452193; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=P4RnQPlmqBzcfDiHCZteURy6me1QA9GlGCFi3SGCF9k=; b=RP07omrE8eTjFJ8BiPEro39TwdE0xy6fil4g2mcDYetnvXgVJDYe6WwNfbxQgiCmJlxaNb jbPAW5Qn69PCRB7XksyvfvnrxzFxS+hfV9s7bg+NWaMpWXhBTTnYcka0u/g0B84Os/2o0E tynRLlTyIOZi7H2XiLVVdJcm5xFjArg= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH v2 13/18] s390x/cpumodel: Fix realize() error API violations Date: Wed, 4 Dec 2019 10:36:20 +0100 Message-Id: <20191204093625.14836-14-armbru@redhat.com> In-Reply-To: <20191204093625.14836-1-armbru@redhat.com> References: <20191204093625.14836-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: -IX65pduNGO0Rz91j0-3TA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 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: Cornelia Huck , David Hildenbrand Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" get_max_cpu_model() dereferences @errp when kvm_s390_get_host_cpu_model() fails, apply_cpu_model() dereferences it when kvm_s390_apply_cpu_model() fails, and s390_realize_cpu_model() dereferences it when get_max_cpu_model() or check_compatibility() fail. That's wrong; see the big comment in error.h. All three introduced in commit 80560137cf "s390x/cpumodel: check and apply the CPU model". No caller actually passes null. Fix anyway: splice in a local Error *err, and error_propagate(). Cc: David Hildenbrand Cc: Cornelia Huck Signed-off-by: Markus Armbruster Reviewed-by: David Hildenbrand --- target/s390x/cpu_models.c | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c index 6a29fd3ab1..c702e34a26 100644 --- a/target/s390x/cpu_models.c +++ b/target/s390x/cpu_models.c @@ -870,6 +870,7 @@ static void check_compatibility(const S390CPUModel *max= _model, =20 static S390CPUModel *get_max_cpu_model(Error **errp) { + Error *err =3D NULL; static S390CPUModel max_model; static bool cached; =20 @@ -878,22 +879,24 @@ static S390CPUModel *get_max_cpu_model(Error **errp) } =20 if (kvm_enabled()) { - kvm_s390_get_host_cpu_model(&max_model, errp); + kvm_s390_get_host_cpu_model(&max_model, &err); } else { max_model.def =3D s390_find_cpu_def(QEMU_MAX_CPU_TYPE, QEMU_MAX_CP= U_GEN, QEMU_MAX_CPU_EC_GA, NULL); bitmap_copy(max_model.features, qemu_max_cpu_feat, S390_FEAT_MAX); - } - if (!*errp) { - cached =3D true; - return &max_model; } - return NULL; + if (err) { + error_propagate(errp, err); + return NULL; + } + cached =3D true; + return &max_model; } =20 static inline void apply_cpu_model(const S390CPUModel *model, Error **errp) { #ifndef CONFIG_USER_ONLY + Error *err =3D NULL; static S390CPUModel applied_model; static bool applied; =20 @@ -909,20 +912,23 @@ static inline void apply_cpu_model(const S390CPUModel= *model, Error **errp) } =20 if (kvm_enabled()) { - kvm_s390_apply_cpu_model(model, errp); + kvm_s390_apply_cpu_model(model, &err); + if (err) { + error_propagate(errp, err); + return; + } } =20 - if (!*errp) { - applied =3D true; - if (model) { - applied_model =3D *model; - } + applied =3D true; + if (model) { + applied_model =3D *model; } #endif } =20 void s390_realize_cpu_model(CPUState *cs, Error **errp) { + Error *err =3D NULL; S390CPUClass *xcc =3D S390_CPU_GET_CLASS(cs); S390CPU *cpu =3D S390_CPU(cs); const S390CPUModel *max_model; @@ -939,7 +945,7 @@ void s390_realize_cpu_model(CPUState *cs, Error **errp) } =20 max_model =3D get_max_cpu_model(errp); - if (*errp) { + if (!max_model) { error_prepend(errp, "CPU models are not available: "); return; } @@ -951,8 +957,9 @@ void s390_realize_cpu_model(CPUState *cs, Error **errp) cpu->model->cpu_ver =3D max_model->cpu_ver; =20 check_consistency(cpu->model); - check_compatibility(max_model, cpu->model, errp); - if (*errp) { + check_compatibility(max_model, cpu->model, &err); + if (err) { + error_propagate(errp, err); return; } =20 --=20 2.21.0 From nobody Mon May 20 06:18:24 2024 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; dkim=fail; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1575456149; cv=none; d=zohomail.com; s=zohoarc; b=Yj/0BISo0OF9nKvWcfhy3fO0TD2OMeyJSon3TYDyxomnJhJIkADqq8LCfY4A+ytINr4ShlBdKF4dGrYo9gLev7YScScthOhQynDAk3I0UetvAsstPBPQXKLg+VE1dvNL3+YHD3H7/N73ELpthEuHuTY328Uj2eHMwbNvIaOKsg0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575456149; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=NE3kP/DOAuh+KztePlu2TgOR4p2JwUK9MqY4o9RapzI=; b=R/dreMWw9vA8DZMN5wSoJh4j1ShtR98GiM85wpyr6IZqnkzGpEykpcIjWLh6O+JbKwV6vM9ANrJ807wHPkoAlm3AbEBSU25D+1aLpKqc/KI07D99csgTQQvBVFuI8q3ZMwK42tIhQ23Y6OMiE7KcI7FK4sQ/X7hP+VJBPygYNdA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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 1575456149490161.5074349141113; Wed, 4 Dec 2019 02:42:29 -0800 (PST) Received: from localhost ([::1]:36658 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icS71-0000NF-87 for importer@patchew.org; Wed, 04 Dec 2019 05:42:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39169) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icR5n-0007J8-Sl for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:37:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1icR5L-0000Xu-3C for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:50 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:42314 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1icR5K-0000MH-UE for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:39 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-146-ARweqmouMWCT93hHyKeCjA-1; Wed, 04 Dec 2019 04:36:35 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7FFEF801E70 for ; Wed, 4 Dec 2019 09:36:34 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-134.ams2.redhat.com [10.36.116.134]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DD4475D6B7; Wed, 4 Dec 2019 09:36:29 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id AF4DD113639C; Wed, 4 Dec 2019 10:36:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575452196; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NE3kP/DOAuh+KztePlu2TgOR4p2JwUK9MqY4o9RapzI=; b=EXpb1r+UCi/0veQSmNOH/NBC6wWOcY6iDplauI8P2EjsQC82Zs/tGviwQKqFcHrl26QO6p EEl+O+BeJ/5xbrGJle33k9y2Oo7QABFH2/car++e5PKIYSwy3TBN1eMqhX+565XW4t24Ha bA52y/Kjjp0ydXBoRu2hpTjy0FUkfFY= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH v2 14/18] s390x/cpumodel: Fix query-cpu-model-FOO error API violations Date: Wed, 4 Dec 2019 10:36:21 +0100 Message-Id: <20191204093625.14836-15-armbru@redhat.com> In-Reply-To: <20191204093625.14836-1-armbru@redhat.com> References: <20191204093625.14836-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: ARweqmouMWCT93hHyKeCjA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 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: Cornelia Huck , David Hildenbrand Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" cpu_model_from_info() is a helper for qmp_query_cpu_model_expansion(), qmp_query_cpu_model_comparison(), qmp_query_cpu_model_baseline(). It dereferences @errp when the visitor or the QOM setter fails. That's wrong; see the big comment in error.h. Introduced in commit 137974cea3 's390x/cpumodel: implement QMP interface "query-cpu-model-expansion"'. Its three callers have the same issue. Introduced in commit 4e82ef0502 's390x/cpumodel: implement QMP interface "query-cpu-model-comparison"' and commit f1a47d08ef 's390x/cpumodel: implement QMP interface "query-cpu-model-baseline"'. No caller actually passes null. Fix anyway: splice in a local Error *err, and error_propagate(). Cc: David Hildenbrand Cc: Cornelia Huck Signed-off-by: Markus Armbruster Reviewed-by: David Hildenbrand --- target/s390x/cpu_models.c | 43 ++++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c index c702e34a26..3ed301b5e5 100644 --- a/target/s390x/cpu_models.c +++ b/target/s390x/cpu_models.c @@ -477,6 +477,7 @@ CpuDefinitionInfoList *qmp_query_cpu_definitions(Error = **errp) static void cpu_model_from_info(S390CPUModel *model, const CpuModelInfo *i= nfo, Error **errp) { + Error *err =3D NULL; const QDict *qdict =3D NULL; const QDictEntry *e; Visitor *visitor; @@ -513,24 +514,26 @@ static void cpu_model_from_info(S390CPUModel *model, = const CpuModelInfo *info, =20 if (qdict) { visitor =3D qobject_input_visitor_new(info->props); - visit_start_struct(visitor, NULL, NULL, 0, errp); - if (*errp) { + visit_start_struct(visitor, NULL, NULL, 0, &err); + if (err) { + error_propagate(errp, err); visit_free(visitor); object_unref(obj); return; } for (e =3D qdict_first(qdict); e; e =3D qdict_next(qdict, e)) { - object_property_set(obj, visitor, e->key, errp); - if (*errp) { + object_property_set(obj, visitor, e->key, &err); + if (err) { break; } } - if (!*errp) { + if (!err) { visit_check_struct(visitor, errp); } visit_end_struct(visitor, NULL); visit_free(visitor); - if (*errp) { + if (err) { + error_propagate(errp, err); object_unref(obj); return; } @@ -595,13 +598,15 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(= CpuModelExpansionType type, CpuModelInfo *model, Error **errp) { + Error *err =3D NULL; CpuModelExpansionInfo *expansion_info =3D NULL; S390CPUModel s390_model; bool delta_changes =3D false; =20 /* convert it to our internal representation */ - cpu_model_from_info(&s390_model, model, errp); - if (*errp) { + cpu_model_from_info(&s390_model, model, &err); + if (err) { + error_propagate(errp, err); return NULL; } =20 @@ -634,18 +639,21 @@ CpuModelCompareInfo *qmp_query_cpu_model_comparison(C= puModelInfo *infoa, CpuModelInfo *infob, Error **errp) { + Error *err =3D NULL; CpuModelCompareResult feat_result, gen_result; CpuModelCompareInfo *compare_info; S390FeatBitmap missing, added; S390CPUModel modela, modelb; =20 /* convert both models to our internal representation */ - cpu_model_from_info(&modela, infoa, errp); - if (*errp) { + cpu_model_from_info(&modela, infoa, &err); + if (err) { + error_propagate(errp, err); return NULL; } - cpu_model_from_info(&modelb, infob, errp); - if (*errp) { + cpu_model_from_info(&modelb, infob, &err); + if (err) { + error_propagate(errp, err); return NULL; } compare_info =3D g_new0(CpuModelCompareInfo, 1); @@ -707,6 +715,7 @@ CpuModelBaselineInfo *qmp_query_cpu_model_baseline(CpuM= odelInfo *infoa, CpuModelInfo *infob, Error **errp) { + Error *err =3D NULL; CpuModelBaselineInfo *baseline_info; S390CPUModel modela, modelb, model; uint16_t cpu_type; @@ -714,13 +723,15 @@ CpuModelBaselineInfo *qmp_query_cpu_model_baseline(Cp= uModelInfo *infoa, uint8_t max_gen; =20 /* convert both models to our internal representation */ - cpu_model_from_info(&modela, infoa, errp); - if (*errp) { + cpu_model_from_info(&modela, infoa, &err); + if (err) { + error_propagate(errp, err); return NULL; } =20 - cpu_model_from_info(&modelb, infob, errp); - if (*errp) { + cpu_model_from_info(&modelb, infob, &err); + if (err) { + error_propagate(errp, err); return NULL; } =20 --=20 2.21.0 From nobody Mon May 20 06:18:24 2024 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; dkim=fail; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1575455794; cv=none; d=zohomail.com; s=zohoarc; b=VbdYew1+AdP/dSchMIoYlLgROw2Zohnf4IVbzYBXAOwVMgV563uDJrQZfqyzB0xUE76SzU/omcjV306d3Rz3ZC63otFk9EQzhbdVBCtQxdppRDXrjTKHAaKYobTwpA2lxrPognZSUHUbeTjmUM3zjAssyjuY1IlWLmMGqiB+j9M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575455794; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=aryLVqd6aYkbTJUrzzMomPXJEC6cSDvsxwWZWhAo3dg=; b=MXG7y5cDRqKaWybOG7alYCZRSYPdG+vVPW+OXWZiqOIpR7Ug3lk3FJkYi3pNyH9ua4DGsB8ygCSV02djsKZkERnVe9vQbty0FE5mORWVFfFUFn2a9JhvfZUVRwpIGWwydiq46gWENkFotIiWLt4RkUbG2pEoi/UDFhHbpAVfnuA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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 1575455794098773.7786260166504; Wed, 4 Dec 2019 02:36:34 -0800 (PST) Received: from localhost ([::1]:36592 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icS1D-0004ZZ-W0 for importer@patchew.org; Wed, 04 Dec 2019 05:36:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38718) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icR5g-0007Ds-FA for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:37:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1icR5J-0000QU-Dl for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:39 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:38344 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1icR5J-0000Fy-6U for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:37 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-382-dpMq_yWmNpm6VQh-vTUPNg-1; Wed, 04 Dec 2019 04:36:33 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C79B310054E3 for ; Wed, 4 Dec 2019 09:36:32 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-134.ams2.redhat.com [10.36.116.134]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DF17F5C1B5; Wed, 4 Dec 2019 09:36:29 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id B28D41135A56; Wed, 4 Dec 2019 10:36:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575452194; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aryLVqd6aYkbTJUrzzMomPXJEC6cSDvsxwWZWhAo3dg=; b=Tk0e5KapxgBxpVekpRBpaoEkFRUXin7VUe/1Pb14ZhJkkJFmWIZRtvsd8uNB2KUol/TKJv rEaGIx12xxfw7sHT9Fcvo/ibVW6CUcHw03CUxHf4NPyRh9q/gh6XgTpWyVbZa331yAREZq czTM7slq6++Kmmuc6+f7RKo3oQtasKM= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH v2 15/18] s390x/cpumodel: Fix query-cpu-definitions error API violations Date: Wed, 4 Dec 2019 10:36:22 +0100 Message-Id: <20191204093625.14836-16-armbru@redhat.com> In-Reply-To: <20191204093625.14836-1-armbru@redhat.com> References: <20191204093625.14836-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: dpMq_yWmNpm6VQh-vTUPNg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 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: Cornelia Huck , David Hildenbrand Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" qmp_query_cpu_definitions() passes @errp to get_max_cpu_model(), then frees any error it gets back. This effectively ignores errors. Dereferencing @errp is wrong; see the big comment in error.h. Passing @errp is also wrong, because it works only as long as @errp is neither @error_fatal nor @error_abort. Introduced in commit 38cba1f4d8 "s390x: return unavailable features via query-cpu-definitions". No caller actually passes such @errp values. Fix anyway: simply pass NULL to get_max_cpu_model(). Cc: David Hildenbrand Cc: Cornelia Huck Signed-off-by: Markus Armbruster Reviewed-by: David Hildenbrand --- target/s390x/cpu_models.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c index 3ed301b5e5..547bab8ac3 100644 --- a/target/s390x/cpu_models.c +++ b/target/s390x/cpu_models.c @@ -462,11 +462,7 @@ CpuDefinitionInfoList *qmp_query_cpu_definitions(Error= **errp) .list =3D NULL, }; =20 - list_data.model =3D get_max_cpu_model(errp); - if (*errp) { - error_free(*errp); - *errp =3D NULL; - } + list_data.model =3D get_max_cpu_model(NULL); =20 object_class_foreach(create_cpu_model_list, TYPE_S390_CPU, false, &list_data); --=20 2.21.0 From nobody Mon May 20 06:18:24 2024 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; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1575457170; cv=none; d=zohomail.com; s=zohoarc; b=efy7dn7rua02/Wb1lmvOAxA6qQsq/yZtlokiW+NbZaY0LBY61BPI3DNmjcS9wv+rj5cHvojExLtoCj7A40gnACI4RzKNMctfp4mCI5rWbNlBK0hDxeEyJ3fu3cwgt6Th+Awj51IZzTwczgDcrgVb/5CdPbLwo6Is8cr1gfHoWWk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575457170; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Oa5WE/nKsyDG9iac2CyuX+6S97udqs/iRIMLUaH3FD8=; b=OdIHgRHjRoT1u5m81Pci2uA+NT/SUIdu6A4IujjwESpqu+uw6OUZ0Mi3TZf4LzeHvrQ9Ld2jNupF784eWgwmVIwVlqhuUkJ6lqGUQ3cyRRgPxWsSoKJEXsEN/vlBjhy2Z302pxTLOVZpLSwKaOg/pYj37BCWJBZouFzMQRfjkUM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass 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 1575457170336909.6890570263912; Wed, 4 Dec 2019 02:59:30 -0800 (PST) Received: from localhost ([::1]:36754 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icSNT-0007rh-6T for importer@patchew.org; Wed, 04 Dec 2019 05:59:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38943) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icR5X-0007FF-9N for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1icR5M-0000dt-Pj for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:45 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:59703 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1icR5L-0000HA-KZ for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:40 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-96-7KsMvBykM2miTJKOptcVcg-1; Wed, 04 Dec 2019 04:36:33 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0F444107ACC4 for ; Wed, 4 Dec 2019 09:36:33 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-134.ams2.redhat.com [10.36.116.134]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E048519C6A; Wed, 4 Dec 2019 09:36:29 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id B5C731135A59; Wed, 4 Dec 2019 10:36:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575452195; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Oa5WE/nKsyDG9iac2CyuX+6S97udqs/iRIMLUaH3FD8=; b=f8/GRM4/bGYo7r16x7J9KUEXBql08Yn2Vu04XpZJCxn5IJ5j5EkBNpPbEuty7boVqJf/zo OXc9Xf3MVhNFqXe/4GePNnuVdopJzNkstUe76TIxSL43ffGAfc8U1kCJAHAbBYrJ7ZzITQ OajD97f+VXPDPee8PvopptfqOZdcCkM= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH v2 16/18] error: Clean up unusual names of Error * variables Date: Wed, 4 Dec 2019 10:36:23 +0100 Message-Id: <20191204093625.14836-17-armbru@redhat.com> In-Reply-To: <20191204093625.14836-1-armbru@redhat.com> References: <20191204093625.14836-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: 7KsMvBykM2miTJKOptcVcg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Local Error * variables are conventionally named @err or @local_err, and Error ** parameters @errp. Naming local variables like parameters is confusing. Clean that up. Naming parameters like local variables is also confusing. Left for another day. Signed-off-by: Markus Armbruster Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/intc/s390_flic_kvm.c | 10 +++++----- hw/ppc/spapr_pci.c | 16 ++++++++-------- hw/ppc/spapr_pci_nvlink2.c | 10 +++++----- tests/test-blockjob.c | 16 ++++++++-------- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/hw/intc/s390_flic_kvm.c b/hw/intc/s390_flic_kvm.c index c9ee80eaae..30d50c2369 100644 --- a/hw/intc/s390_flic_kvm.c +++ b/hw/intc/s390_flic_kvm.c @@ -582,10 +582,10 @@ static void kvm_s390_flic_realize(DeviceState *dev, E= rror **errp) struct kvm_create_device cd =3D {0}; struct kvm_device_attr test_attr =3D {0}; int ret; - Error *errp_local =3D NULL; + Error *err =3D NULL; =20 - KVM_S390_FLIC_GET_CLASS(dev)->parent_realize(dev, &errp_local); - if (errp_local) { + KVM_S390_FLIC_GET_CLASS(dev)->parent_realize(dev, &err); + if (err) { goto fail; } flic_state->fd =3D -1; @@ -593,7 +593,7 @@ static void kvm_s390_flic_realize(DeviceState *dev, Err= or **errp) cd.type =3D KVM_DEV_TYPE_FLIC; ret =3D kvm_vm_ioctl(kvm_state, KVM_CREATE_DEVICE, &cd); if (ret < 0) { - error_setg_errno(&errp_local, errno, "Creating the KVM device fail= ed"); + error_setg_errno(&err, errno, "Creating the KVM device failed"); trace_flic_create_device(errno); goto fail; } @@ -605,7 +605,7 @@ static void kvm_s390_flic_realize(DeviceState *dev, Err= or **errp) KVM_HAS_DEVICE_ATTR, test_attr= ); return; fail: - error_propagate(errp, errp_local); + error_propagate(errp, err); } =20 static void kvm_s390_flic_reset(DeviceState *dev) diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index f6fbcf99ed..723373de73 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -2042,13 +2042,13 @@ void spapr_phb_dma_reset(SpaprPhbState *sphb) static void spapr_phb_reset(DeviceState *qdev) { SpaprPhbState *sphb =3D SPAPR_PCI_HOST_BRIDGE(qdev); - Error *errp =3D NULL; + Error *err =3D NULL; =20 spapr_phb_dma_reset(sphb); spapr_phb_nvgpu_free(sphb); - spapr_phb_nvgpu_setup(sphb, &errp); - if (errp) { - error_report_err(errp); + spapr_phb_nvgpu_setup(sphb, &err); + if (err) { + error_report_err(err); } =20 /* Reset the IOMMU state */ @@ -2326,7 +2326,7 @@ int spapr_dt_phb(SpaprMachineState *spapr, SpaprPhbSt= ate *phb, cpu_to_be32(phb->numa_node)}; SpaprTceTable *tcet; SpaprDrc *drc; - Error *errp =3D NULL; + Error *err =3D NULL; =20 /* Start populating the FDT */ _FDT(bus_off =3D fdt_add_subnode(fdt, 0, phb->dtbusname)); @@ -2408,9 +2408,9 @@ int spapr_dt_phb(SpaprMachineState *spapr, SpaprPhbSt= ate *phb, return ret; } =20 - spapr_phb_nvgpu_populate_dt(phb, fdt, bus_off, &errp); - if (errp) { - error_report_err(errp); + spapr_phb_nvgpu_populate_dt(phb, fdt, bus_off, &err); + if (err) { + error_report_err(err); } spapr_phb_nvgpu_ram_populate_dt(phb, fdt); =20 diff --git a/hw/ppc/spapr_pci_nvlink2.c b/hw/ppc/spapr_pci_nvlink2.c index 4aa89ede23..8332d5694e 100644 --- a/hw/ppc/spapr_pci_nvlink2.c +++ b/hw/ppc/spapr_pci_nvlink2.c @@ -57,7 +57,7 @@ struct SpaprPhbPciNvGpuConfig { uint64_t nv2_atsd_current; int num; /* number of non empty (i.e. tgt!=3D0) entries in slots[] */ SpaprPhbPciNvGpuSlot slots[NVGPU_MAX_NUM]; - Error *errp; + Error *err; }; =20 static SpaprPhbPciNvGpuSlot * @@ -153,7 +153,7 @@ static void spapr_phb_pci_collect_nvgpu(PCIBus *bus, PC= IDevice *pdev, spapr_pci_collect_nvnpu(nvgpus, pdev, tgt, MEMORY_REGION(mr_np= u), &local_err); } - error_propagate(&nvgpus->errp, local_err); + error_propagate(&nvgpus->err, local_err); } if ((pci_default_read_config(pdev, PCI_HEADER_TYPE, 1) !=3D PCI_HEADER_TYPE_BRIDGE)) { @@ -187,9 +187,9 @@ void spapr_phb_nvgpu_setup(SpaprPhbState *sphb, Error *= *errp) pci_for_each_device(bus, pci_bus_num(bus), spapr_phb_pci_collect_nvgpu, sphb->nvgpus); =20 - if (sphb->nvgpus->errp) { - error_propagate(errp, sphb->nvgpus->errp); - sphb->nvgpus->errp =3D NULL; + if (sphb->nvgpus->err) { + error_propagate(errp, sphb->nvgpus->err); + sphb->nvgpus->err =3D NULL; goto cleanup_exit; } =20 diff --git a/tests/test-blockjob.c b/tests/test-blockjob.c index 7844c9ffcb..e670a20617 100644 --- a/tests/test-blockjob.c +++ b/tests/test-blockjob.c @@ -34,13 +34,13 @@ static BlockJob *mk_job(BlockBackend *blk, const char *= id, int flags) { BlockJob *job; - Error *errp =3D NULL; + Error *err =3D NULL; =20 job =3D block_job_create(id, drv, NULL, blk_bs(blk), 0, BLK_PERM_ALL, 0, flags, block_job_cb, - NULL, &errp); + NULL, &err); if (should_succeed) { - g_assert_null(errp); + g_assert_null(err); g_assert_nonnull(job); if (id) { g_assert_cmpstr(job->job.id, =3D=3D, id); @@ -48,9 +48,9 @@ static BlockJob *mk_job(BlockBackend *blk, const char *id, g_assert_cmpstr(job->job.id, =3D=3D, blk_name(blk)); } } else { - g_assert_nonnull(errp); + g_assert_nonnull(err); g_assert_null(job); - error_free(errp); + error_free(err); } =20 return job; @@ -80,9 +80,9 @@ static BlockBackend *create_blk(const char *name) bdrv_unref(bs); =20 if (name) { - Error *errp =3D NULL; - monitor_add_blk(blk, name, &errp); - g_assert_null(errp); + Error *err =3D NULL; + monitor_add_blk(blk, name, &err); + g_assert_null(err); } =20 return blk; --=20 2.21.0 From nobody Mon May 20 06:18:24 2024 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; dkim=fail; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1575454793; cv=none; d=zohomail.com; s=zohoarc; b=kFuXeV109CIXhhjVh4y6zQU7hOzJItMmgyIURVT4m4DFBpsHMqJKzCcRKX3usZEDaJZaZBI1aXpn3q/bLs9ArbIh6AQ6AhpDe54MwIlxED1u2yP+js53eLP4WSYxxDE511GDv0WL3BvyLwJuQV9pLyHVAvKJZ3yCk0lqWC00QFE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575454793; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=14FWoiUPuC2dvHRmr4gxNehnlsWm5XKtEJ5hCDY2NmI=; b=COg0rEP5N+AcRzJSOpShfJDGR5JX6GgxPGM3f27GWL4OWaABaGnnCvOavPQF5KmBzSSMLAHHZFKGuxl5Zqj8y5WZwgSgoAKtntSSyuNQDuKpmDziJix0xOEgRO5u/IOXvUSExokYLhhN2h6ZNbLQOrzpRPz0uKgip4/rivRO3k0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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 1575454793061129.66596376775692; Wed, 4 Dec 2019 02:19:53 -0800 (PST) Received: from localhost ([::1]:36488 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icRl5-0005ks-IL for importer@patchew.org; Wed, 04 Dec 2019 05:19:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38654) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icR5e-0007DF-VO for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:37:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1icR5H-0000K0-TZ for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:38 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:38437 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1icR5H-00005y-N8 for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:35 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-224-LWMN6jSYNcCu74znihV8hw-1; Wed, 04 Dec 2019 04:36:31 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 282B118543A0; Wed, 4 Dec 2019 09:36:30 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-134.ams2.redhat.com [10.36.116.134]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E5B715D6BB; Wed, 4 Dec 2019 09:36:29 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id B8FA41135A5A; Wed, 4 Dec 2019 10:36:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575452192; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=14FWoiUPuC2dvHRmr4gxNehnlsWm5XKtEJ5hCDY2NmI=; b=TB3ydu66pS236gvip0dQBL36Iqe3T3eKNT9Eab7ZT4amZJYwRvJQ7s4aAE+tJLvaWW3tG7 YeJlnfuqbe8Ndo3NnK1eUoO708WsZvyLGi7u2yzWWtVvTUdWU4bOeVLK02dWVQnBGo7FaE qnsu71u5VZDDFi15O/oCnQz3qep3OAE= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH v2 17/18] hw/intc/s390: Simplify error handling in kvm_s390_flic_realize() Date: Wed, 4 Dec 2019 10:36:24 +0100 Message-Id: <20191204093625.14836-18-armbru@redhat.com> In-Reply-To: <20191204093625.14836-1-armbru@redhat.com> References: <20191204093625.14836-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: LWMN6jSYNcCu74znihV8hw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 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: Halil Pasic , Christian Borntraeger , Cornelia Huck Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Cc: Halil Pasic Cc: Cornelia Huck Cc: Christian Borntraeger Signed-off-by: Markus Armbruster Reviewed-by: Cornelia Huck Acked-by: Halil Pasic --- hw/intc/s390_flic_kvm.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/hw/intc/s390_flic_kvm.c b/hw/intc/s390_flic_kvm.c index 30d50c2369..dddd33ea61 100644 --- a/hw/intc/s390_flic_kvm.c +++ b/hw/intc/s390_flic_kvm.c @@ -586,16 +586,17 @@ static void kvm_s390_flic_realize(DeviceState *dev, E= rror **errp) =20 KVM_S390_FLIC_GET_CLASS(dev)->parent_realize(dev, &err); if (err) { - goto fail; + error_propagate(errp, err); + return; } flic_state->fd =3D -1; =20 cd.type =3D KVM_DEV_TYPE_FLIC; ret =3D kvm_vm_ioctl(kvm_state, KVM_CREATE_DEVICE, &cd); if (ret < 0) { - error_setg_errno(&err, errno, "Creating the KVM device failed"); + error_setg_errno(errp, errno, "Creating the KVM device failed"); trace_flic_create_device(errno); - goto fail; + return; } flic_state->fd =3D cd.fd; =20 @@ -603,9 +604,6 @@ static void kvm_s390_flic_realize(DeviceState *dev, Err= or **errp) test_attr.group =3D KVM_DEV_FLIC_CLEAR_IO_IRQ; flic_state->clear_io_supported =3D !ioctl(flic_state->fd, KVM_HAS_DEVICE_ATTR, test_attr= ); - return; -fail: - error_propagate(errp, err); } =20 static void kvm_s390_flic_reset(DeviceState *dev) --=20 2.21.0 From nobody Mon May 20 06:18:24 2024 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; dkim=fail; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1575455926; cv=none; d=zohomail.com; s=zohoarc; b=Qml0JIBCxV/PyeytTbpJE5yH3Q87pcu8C5rH/n/oHduv1iHM/ksuZqjqRsnu6i5AW/7xZ1HY/+Bb1nGP7h5zsLCVeZkDmAinw0DPvhcROLYO0VgAZzgYIboydcI/omDwb9ZRBpQijWeL7CDbTTLqdKrM0EQt4rfge4VBD9swjBE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575455926; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=VcQfbWOSujNj2P6dQg61amOzZoiTXvVBDPQOllhUYpQ=; b=Mzr4dt0ZOzhZvjRwz8QSQ87YPc1/S12BZAFDLt7GxnPj6rCgVkTzzXVbk0qk8zfa8Xhsh0rjwAXfubu1YXYL+y5JeLFWThC6Ty9uAgEDSiPduFhlHw5HsNG+8o7TMDv9NMY92WzGuWrbpOj3ZPgpF26ZUrmfL5ungJkRvWQ8Gq0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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 157545592698437.195699672213436; Wed, 4 Dec 2019 02:38:46 -0800 (PST) Received: from localhost ([::1]:36614 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icS3Q-0006HX-DV for importer@patchew.org; Wed, 04 Dec 2019 05:38:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39061) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icR5a-0007GO-Ee for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1icR5K-0000U2-7Y for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:48 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:25634 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1icR5K-00007m-2h for qemu-devel@nongnu.org; Wed, 04 Dec 2019 04:36:38 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-162-JAQm_k9SOUSeBuStts26fQ-1; Wed, 04 Dec 2019 04:36:30 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 277BF107ACC4 for ; Wed, 4 Dec 2019 09:36:30 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-134.ams2.redhat.com [10.36.116.134]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E9BA260C63; Wed, 4 Dec 2019 09:36:29 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id BC27E1135A63; Wed, 4 Dec 2019 10:36:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575452192; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VcQfbWOSujNj2P6dQg61amOzZoiTXvVBDPQOllhUYpQ=; b=AzZgIzKa9xKtrjP284tvJgTPZrYYFU5VHoCUIgD7gxBwqHNaaMR1VbUWEFL/3EUG/2eNja lw43jOMVJm3PvlW1tdHHPPIAM0VSyxNlYAhaDSW7Ypgg+/yYlgRyGR/aUpWcfTVAGbLsHH ztJFEKVRjzBhAjneBscDs3SlY/K8q+k= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH v2 18/18] tests-blockjob: Use error_free_or_abort() Date: Wed, 4 Dec 2019 10:36:25 +0100 Message-Id: <20191204093625.14836-19-armbru@redhat.com> In-Reply-To: <20191204093625.14836-1-armbru@redhat.com> References: <20191204093625.14836-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: JAQm_k9SOUSeBuStts26fQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake --- tests/test-blockjob.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/test-blockjob.c b/tests/test-blockjob.c index e670a20617..4eeb184caf 100644 --- a/tests/test-blockjob.c +++ b/tests/test-blockjob.c @@ -48,9 +48,8 @@ static BlockJob *mk_job(BlockBackend *blk, const char *id, g_assert_cmpstr(job->job.id, =3D=3D, blk_name(blk)); } } else { - g_assert_nonnull(err); + error_free_or_abort(&err); g_assert_null(job); - error_free(err); } =20 return job; --=20 2.21.0