From nobody Sat Apr 20 14:06:41 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=1575143483; cv=none; d=zohomail.com; s=zohoarc; b=l4+IU58nsQz66nT0qQebrkUSbijbSJesbR0YYlt3dnYuv7s50yG/3mTyH2acS4Q8GTd0+bKe8KGH0bWHJJpk2zXc1RnG3f0NFCsGEsky0T+UaEdpdDbN/jwPDkzVWNAzU1wgnOuIbm4QGtnPIVqIrOmqPDq0EpI14k7Lu5F+mV0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575143483; 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=QqX1QH5afYUXC10/rVNgiR/DuTiOhSvgW/1+jEyMUHQ=; b=FobsnyNuOGQFuIiAWPWHWFmbaOR/gUZJYwrksutE+/GZ6scGfXlYSybur8OYgeje7b03/v5DCdTtXN0DUcuVkh7Iqr40w9zwsP8hz3GTP8YgHI41/TjMQ/1oeAlFjOXEIGwNeZRHw0X/K0jKR5mqml9VhRd/vNRUWgB+2FQHJAs= 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 1575143483848149.86578124164862; Sat, 30 Nov 2019 11:51:23 -0800 (PST) Received: from localhost ([::1]:37720 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ib8m1-0007lL-Oz for importer@patchew.org; Sat, 30 Nov 2019 14:51:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53529) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ib8ds-0006Tk-Qx for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:42:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ib8dq-00058y-S1 for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:42:56 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:50963 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 1ib8do-00055M-R1 for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:42:54 -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-241-EOCCzsdjN-WplvAgIhdMUg-1; Sat, 30 Nov 2019 14:42:49 -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 DB7EE800D41; Sat, 30 Nov 2019 19:42:48 +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 7145B19C5B; Sat, 30 Nov 2019 19:42:43 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 082C811385C7; Sat, 30 Nov 2019 20:42:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575142971; 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=QqX1QH5afYUXC10/rVNgiR/DuTiOhSvgW/1+jEyMUHQ=; b=PusjTVadOOL0gYMTMQTwaBTkp9riFIDJDgmNj+yPLQDcTSmWnxlsi6IAI59wQA78aDIhoI xLsmUF/Fela5AQuuvLG7S4FLk1OEbKNDf9zfK78hPKMUKR8JW980xki8UJn5y5XrgRTL/u YEUkof/kt3lxebig+gj4y8CdK7z7Ll8= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 01/21] net/virtio: Drop useless n->primary_dev not null checks Date: Sat, 30 Nov 2019 20:42:20 +0100 Message-Id: <20191130194240.10517-2-armbru@redhat.com> In-Reply-To: <20191130194240.10517-1-armbru@redhat.com> References: <20191130194240.10517-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: EOCCzsdjN-WplvAgIhdMUg-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: vsementsov@virtuozzo.com, Jens Freimann , "Michael S . Tsirkin" 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" virtio_net_handle_migration_primary() returns early when it can't ensure n->primary_dev is non-null. Checking it again right after that early return is redundant. Drop. If n->primary_dev is null on entering failover_replug_primary(), @pdev will become null, and pdev->partially_hotplugged will crash. Checking n->primary_dev later is useless. It can't actually be null, because its caller virtio_net_handle_migration_primary() ensures it isn't. Drop the useless check. Cc: Jens Freimann Cc: Michael S. Tsirkin Signed-off-by: Markus Armbruster Reviewed-by: Jens Freimann Reviewed-by: Michael S. Tsirkin --- hw/net/virtio-net.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 3c31471026..87088ba374 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -2810,11 +2810,6 @@ static bool failover_replug_primary(VirtIONet *n, Er= ror **errp) goto out; } } - if (!n->primary_dev) { - error_setg(errp, "virtio_net: couldn't find primary device"); - goto out; - } - n->primary_bus =3D n->primary_dev->parent_bus; if (!n->primary_bus) { error_setg(errp, "virtio_net: couldn't find primary bus"); @@ -2849,8 +2844,7 @@ static void virtio_net_handle_migration_primary(VirtI= ONet *n, } } =20 - if (migration_in_setup(s) && !should_be_hidden && - n->primary_dev) { + if (migration_in_setup(s) && !should_be_hidden) { if (failover_unplug_primary(n)) { vmstate_unregister(n->primary_dev, qdev_get_vmsd(n->primary_de= v), n->primary_dev); --=20 2.21.0 From nobody Sat Apr 20 14:06:41 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=1575143111; cv=none; d=zohomail.com; s=zohoarc; b=V/fu/0FuWdAgLV7esSF9MD4WmXsV9Hcp3oqGkDrhKI+9/nG0AfrzuS1mxQh1YOAsvUPgqMUGsDs0S4n86bGY27NazUdEUGB9xsYoh/WnmthGPPq6j92JgZPUTfVpUrCCpnlMjTQ+HpxLV94G0EVEg332lcU2eBMFLLfdBgqsTFk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575143111; 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=fiBMWv3b4dYJ2SZifg0hNYS4tAtr7MwqgE6vP+ma9M0=; b=Q2ZIITnG1AHYnZKU10I6RTTQet/iJhsFkYJ5ztz5qHVVEG8Alx3oNq2X7AtRLE2mDB04rgmk0dqftwsch8toVrtinwPcQwxBQIlfWE4vCNTxLUFdGIi8tylxbkC1wxvtOkg6fts0/AeeDz1Wx2JhMC1IE5QX72ia95ZYV1Ug+hQ= 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 1575143111981465.9311153781008; Sat, 30 Nov 2019 11:45:11 -0800 (PST) Received: from localhost ([::1]:37638 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ib8g1-0008Fa-N8 for importer@patchew.org; Sat, 30 Nov 2019 14:45:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53530) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ib8ds-0006Tl-RB for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:42:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ib8dq-000595-SK for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:42:56 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:48547 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 1ib8do-000554-R3 for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:42:54 -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-98-itZyFkEUPZ2YQnrYZa-nvQ-1; Sat, 30 Nov 2019 14:42:49 -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 EA4D7DB20; Sat, 30 Nov 2019 19:42:48 +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 712AC1001281; Sat, 30 Nov 2019 19:42:43 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 0BC5811366CC; Sat, 30 Nov 2019 20:42:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575142971; 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=fiBMWv3b4dYJ2SZifg0hNYS4tAtr7MwqgE6vP+ma9M0=; b=OTqWS+sEt3BwwOwUL5rWIB+g4J0pgOGWMJOSaQw+jvi73PTh7QNVsoteIREG7CJIOQKyzw fgvVLRzDca3wkYid/BIZvBq/cICe5aKG4gGJKk56mUu1+N4KY4/geNoFrLt2qYfWFNpf0z 052w95tAD5H6DJ7LH9t3rjGy9qwSC6k= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 02/21] net/virtio: Fix failover error handling crash bugs Date: Sat, 30 Nov 2019 20:42:21 +0100 Message-Id: <20191130194240.10517-3-armbru@redhat.com> In-Reply-To: <20191130194240.10517-1-armbru@redhat.com> References: <20191130194240.10517-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: itZyFkEUPZ2YQnrYZa-nvQ-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: vsementsov@virtuozzo.com, Jens Freimann , "Michael S . Tsirkin" 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" Functions that take an Error ** parameter to pass an error to the caller expect the parameter to point to null. failover_replug_primary() violates this precondition in several places: * After qemu_opts_from_qdict() failed, *errp is no longer null. Passing it to error_setg() is wrong, and will trip the assertion in error_setv(). Messed up in commit 150ab54aa6 "net/virtio: fix re-plugging of primary device". Simply drop the error_setg(). * Passing @errp to qemu_opt_set_bool(), hotplug_handler_pre_plug(), and hotplug_handler_plug() is wrong. If one of the first two fails, *errp is no longer null. Risks tripping the same assertion. Moreover, continuing after such errors is unsafe. Messed up in commit 9711cd0dfc "net/virtio: add failover support". Fix by handling each error properly. failover_replug_primary() crashes when passed a null @errp. Also messed up in commit 9711cd0dfc. This bug can't bite as no caller actually passes null. Fix it anyway. Fixes: 9711cd0dfc3fa414f7f64935713c07134ae67971 Fixes: 150ab54aa6934583180f88a2bd540bc6fc4fbff3 Cc: Jens Freimann Cc: Michael S. Tsirkin Signed-off-by: Markus Armbruster Reviewed-by: Jens Freimann Reviewed-by: Michael S. Tsirkin --- hw/net/virtio-net.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 87088ba374..db3d7c38e6 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -2795,6 +2795,7 @@ static bool failover_unplug_primary(VirtIONet *n) =20 static bool failover_replug_primary(VirtIONet *n, Error **errp) { + Error *err =3D NULL; HotplugHandler *hotplug_ctrl; PCIDevice *pdev =3D PCI_DEVICE(n->primary_dev); =20 @@ -2806,27 +2807,33 @@ static bool failover_replug_primary(VirtIONet *n, E= rror **errp) qemu_find_opts("device"), n->primary_device_dict, errp); if (!n->primary_device_opts) { - error_setg(errp, "virtio_net: couldn't find primary device opt= s"); - goto out; + return false; } } n->primary_bus =3D n->primary_dev->parent_bus; if (!n->primary_bus) { error_setg(errp, "virtio_net: couldn't find primary bus"); - goto out; + return false; } qdev_set_parent_bus(n->primary_dev, n->primary_bus); n->primary_should_be_hidden =3D false; qemu_opt_set_bool(n->primary_device_opts, - "partially_hotplugged", true, errp); + "partially_hotplugged", true, &err); + if (err) { + goto out; + } hotplug_ctrl =3D qdev_get_hotplug_handler(n->primary_dev); if (hotplug_ctrl) { - hotplug_handler_pre_plug(hotplug_ctrl, n->primary_dev, errp); + hotplug_handler_pre_plug(hotplug_ctrl, n->primary_dev, &err); + if (err) { + goto out; + } hotplug_handler_plug(hotplug_ctrl, n->primary_dev, errp); } =20 out: - return *errp =3D=3D NULL; + error_propagate(errp, err); + return !err; } =20 static void virtio_net_handle_migration_primary(VirtIONet *n, --=20 2.21.0 From nobody Sat Apr 20 14:06:41 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=1575143104; cv=none; d=zohomail.com; s=zohoarc; b=L5yuekUjA4Lm7SC/Zz9flIxCaDYRHQVaUC4w0liQ42YURYvZOKh0g5vPRlWBt1MhwxJyYgCyrGNjogUACSz6Bf0I/5Y1AeZIDre5BPuXeXEdEvuHn5XU+7nn9QK7G0FETKAtKwIifobsGZzpr3fN21ZQYGtPV8myGKZL2zKfy/M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575143104; 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=vJaBWRixGViWAeulqiB62tyEcddZ3xek8SJVT6ZMmAA=; b=lOtffbcPh3nHJjr4enNOmlGineZvZBRTI8Bi9G17xSfi4vIgB0i8Y82zzZpkjxPhd466ejPHzmhkvNh/nSw6PrNkuqsP74+6oHlc5aU8l8OlWrEw0AGj6PRcCLr9iriGfoChMHxCAvgGUzM25DUg4Oya6gPHUsybY7eNpOV91xM= 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 1575143104880885.3412111062372; Sat, 30 Nov 2019 11:45:04 -0800 (PST) Received: from localhost ([::1]:37636 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ib8fu-00086i-56 for importer@patchew.org; Sat, 30 Nov 2019 14:45:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53466) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ib8dq-0006Qc-Al for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:42:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ib8dm-000549-Ss for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:42:52 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:46272 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 1ib8dm-00052v-0J for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:42:50 -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-80-i1wNotwBOZ2_OPgq2EG6jw-1; Sat, 30 Nov 2019 14:42:47 -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 4F4C7800D41; Sat, 30 Nov 2019 19:42:46 +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 59051611DB; Sat, 30 Nov 2019 19:42:43 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 1134B11366CF; Sat, 30 Nov 2019 20:42:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575142968; 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=vJaBWRixGViWAeulqiB62tyEcddZ3xek8SJVT6ZMmAA=; b=E/V4oXZIJAStWonGOKL12rASRYYsc2sa3+7LDBjkk1CNssCZIZggEE9GF/NRlmAW8qQv3n x/b6YTJBmmi9ft+40pKvSfqWgRwNKQKh2chjz9f6BdlVdCto8ucWG5bndLdOG6biHYqWVf eBocCHtzQr8l1BWxedpjZAAu3OniQDQ= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 03/21] block/file-posix: Fix laio_init() error handling crash bug Date: Sat, 30 Nov 2019 20:42:22 +0100 Message-Id: <20191130194240.10517-4-armbru@redhat.com> In-Reply-To: <20191130194240.10517-1-armbru@redhat.com> References: <20191130194240.10517-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: i1wNotwBOZ2_OPgq2EG6jw-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: Kevin Wolf , vsementsov@virtuozzo.com, Nishanth Aravamudan , Stefan Hajnoczi 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" raw_aio_attach_aio_context() passes uninitialized Error *local_err by reference to laio_init() via aio_setup_linux_aio(). When laio_init() fails, it passes it on to error_setg_errno(), tripping error_setv()'s assertion unless @local_err is null by dumb luck. Fix by initializing @local_err properly. Fixes: ed6e2161715c527330f936d44af4c547f25f687e Cc: Nishanth Aravamudan Cc: Stefan Hajnoczi Cc: Kevin Wolf Signed-off-by: Markus Armbruster Reviewed-by: Kevin Wolf Reviewed-by: Michael S. Tsirkin Reviewed-by: Stefan Hajnoczi --- block/file-posix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/file-posix.c b/block/file-posix.c index 1f0f61a02b..1b805bd938 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -1973,7 +1973,7 @@ static void raw_aio_attach_aio_context(BlockDriverSta= te *bs, #ifdef CONFIG_LINUX_AIO BDRVRawState *s =3D bs->opaque; if (s->use_linux_aio) { - Error *local_err; + Error *local_err =3D NULL; if (!aio_setup_linux_aio(new_context, &local_err)) { error_reportf_err(local_err, "Unable to use native AIO, " "falling back to thread pool: "); --=20 2.21.0 From nobody Sat Apr 20 14:06:41 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=1575143104; cv=none; d=zohomail.com; s=zohoarc; b=XqQqdUv8ZqAnJUfX3E+yWL+0uXLKq2XruFVpp0PbXxmuDIHmvsjDCJ5CPvuRonl6J0Osnj5tdVMgJ+c2arZbW4GR1Cbe8L2KpohCHU+NIIy2WFuav9l5+pghx7tbMejYF4aXvt8y2ctE4nn7+njg6VKTSk6lWhNxdmBOK0makns= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575143104; 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=K+wo9Fn4zYiYTFIOLtKeSoo5QrVxET7TfxcPqyYVIXgXLjGWx3GummbaLK+XGV87bvk1ugNFJdJ0h4vcmVqPRDM0ydjzt+zx42G+ANe48Z9ZoChXk+hSy3mmlYNqBo31YK0tg0TpJ6FshOog6D7aKB2u7s3x1NgAOzHDMjIJ/2M= 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 1575143104880169.9744802968579; Sat, 30 Nov 2019 11:45:04 -0800 (PST) Received: from localhost ([::1]:37634 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ib8fu-00085G-S0 for importer@patchew.org; Sat, 30 Nov 2019 14:45:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53467) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ib8dq-0006Qd-At for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:42:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ib8dm-000543-SE for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:42:52 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:40585 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 1ib8dl-000531-US for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:42:50 -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-428-AngOt7hSMNiyZx1pES8rMQ-1; Sat, 30 Nov 2019 14:42:47 -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 45E7F80183C; Sat, 30 Nov 2019 19:42:46 +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 713FF19C58; Sat, 30 Nov 2019 19:42:43 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 11E5511366D1; Sat, 30 Nov 2019 20:42:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575142968; 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=PRCu9a10VKpLEXI7oP6nfig8Q4I9AY+ZZef/WGxnSSmTV/kRfEyA/XdeNIXG/9GEP5DrnJ gpz/f3dc8vJYycv4+qSn0yUyRWsRausD76bph6W2Xx8JhYNDoac5eNeOKsm0h0tiI/+IUO xciWDM/BKWv+LTeS/5zSRrrjOxEAeEE= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 04/21] crypto: Fix certificate file error handling crash bug Date: Sat, 30 Nov 2019 20:42:23 +0100 Message-Id: <20191130194240.10517-5-armbru@redhat.com> In-Reply-To: <20191130194240.10517-1-armbru@redhat.com> References: <20191130194240.10517-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: AngOt7hSMNiyZx1pES8rMQ-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: vsementsov@virtuozzo.com, =?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 Reviewed-by: Michael S. Tsirkin Reviewed-by: Vladimir Sementsov-Ogievskiy --- 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 Sat Apr 20 14:06:41 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=1575143308; cv=none; d=zohomail.com; s=zohoarc; b=J5/6uyGd9UkAQCC8rqHHEeke7X+9AUun7ow992vqgfZI5W/gxHPoi8rXfAGr67V33yuIQ1wR4PXNZtyBLtDPgLu1oSvvR+bIkmfmeirVqE41clq7x/2Vuz1RH1OY2RPMkY6OvvQLZIzihSDjRGwQabrjeAyVDRc6bsv+53wsNqM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575143308; 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=WucgcwacPFHI8WFE0LVcyuCjJ9pFPXKhHnDXCUXKjM2Jw/Z2OBJFX3WSLzqeb1oynHud5nMVAz99xz0uEm6uzu4HQ3mdIppDh+Mr36ENkQ+tMjO6XVL+ixPYSeuu1MjHAZIIVstACjqBRCcaScfsxZIm5XB7buSkVVggUw67Ua0= 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 1575143308327372.50347369374697; Sat, 30 Nov 2019 11:48:28 -0800 (PST) Received: from localhost ([::1]:37680 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ib8jC-00047E-TC for importer@patchew.org; Sat, 30 Nov 2019 14:48:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53486) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ib8dq-0006T6-Qy for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:42:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ib8dm-00054Y-Vg for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:42:54 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:55331 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 1ib8dm-00053N-Rx for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:42:50 -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-268-Vk1-qVv0NVKLpLhdgli6vQ-1; Sat, 30 Nov 2019 14:42:48 -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 B1FF0184CABB; Sat, 30 Nov 2019 19:42:47 +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 81CDD1001938; Sat, 30 Nov 2019 19:42:47 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 15F8B11366D5; Sat, 30 Nov 2019 20:42:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575142969; 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=MtCS2dxHRwpZo7dn0gJppp5jMk+wOhGRNLy3MaiCAYOl7zd4MPKBBUJpWLw6788k8fX5Jp LtttsJV7sTkpePtO66sHdinnMd5xuN7iSU9myMYOqvxq81s2lV/oiFrPGFJvrQ9o34EODb pNE3nbuGUpuBkeeWgOHMxFQk6laPaQE= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 05/21] crypto: Fix typo in QCryptoTLSSession's comment Date: Sat, 30 Nov 2019 20:42:24 +0100 Message-Id: <20191130194240.10517-6-armbru@redhat.com> In-Reply-To: <20191130194240.10517-1-armbru@redhat.com> References: <20191130194240.10517-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: Vk1-qVv0NVKLpLhdgli6vQ-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: vsementsov@virtuozzo.com, =?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 Reviewed-by: Michael S. Tsirkin Reviewed-by: Vladimir Sementsov-Ogievskiy --- 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 Sat Apr 20 14:06:41 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=1575143913; cv=none; d=zohomail.com; s=zohoarc; b=n2GmLs1ph13CW6UYkRpnfySGEo1xylJwj3hBtukvb/MbE9jvlsrlhk5Fl11/0dlq95vUYJ210/HMRvQBvZaptNiUl/sA9c0a4rXw+uoD9EorYEJZU/g6CTk8ZtMoj+dYDgCmR69u49NgzERelpPo80w+erN/Yer28VkXwDrvU60= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575143913; 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=n9Zhraq/FpnSQ+/bdtNbI3NwafjiM0ePqWLCOmWgvqQCyBECjR4IZi9GfzFdb135gxizfsQnl2T2lBsQTJV5lheZgk0D/olPlxHtagf7NexJo2zF7r8QLjmLTZ7hbxHjJ1s3ilsh0yk7LYF/Rns5M+YDUOqrdOraf98I4JkZKjo= 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 1575143913706142.8744452731387; Sat, 30 Nov 2019 11:58:33 -0800 (PST) Received: from localhost ([::1]:37804 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ib8sy-0008Ne-9q for importer@patchew.org; Sat, 30 Nov 2019 14:58:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53531) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ib8ds-0006Tn-Qu for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:43:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ib8dq-00059D-SW for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:42:56 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:49679 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 1ib8do-00055R-RR for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:42:54 -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-232-sNA1v2rQPBq7gX7qOtKxUA-1; Sat, 30 Nov 2019 14:42:48 -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 B6A6B184CABC; Sat, 30 Nov 2019 19:42:47 +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 84BD319C58; Sat, 30 Nov 2019 19:42:47 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 1951011366DB; Sat, 30 Nov 2019 20:42:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575142972; 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=f/3QvFNp0KwEb8biJJ3ToPU0HjUgPAHaki9xt9M/+pO5fpUjTZ8I0iO2Gje9p00uFIXach t+LKBKjgL1ZWB8xSUPtBtqYm7ye8BE3WLUCkbCKa9tDFJgnL5nQTU959NdW4KBMZ6h4c/q ckl5Vycn9f8DATPpi80IAL32h5rXbnU= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 06/21] io: Fix Error usage in a comment Date: Sat, 30 Nov 2019 20:42:25 +0100 Message-Id: <20191130194240.10517-7-armbru@redhat.com> In-Reply-To: <20191130194240.10517-1-armbru@redhat.com> References: <20191130194240.10517-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: sNA1v2rQPBq7gX7qOtKxUA-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: vsementsov@virtuozzo.com, =?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 Reviewed-by: Michael S. Tsirkin Reviewed-by: Vladimir Sementsov-Ogievskiy --- 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 Sat Apr 20 14:06:41 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=1575143301; cv=none; d=zohomail.com; s=zohoarc; b=kSdjp0jBzs85wNUyWXEgSHvq5yZ4TnZxdLtdeFURKeTaieBF5BKqA5Shb+ZkdHu8zAcwiI4lTaLn/VFVmZaaxAhENkhDdOhccwFtrGOAbeq7Ak/e68EP/Ys49V5NjgmOPWIAcQSkBh0B1/wNQ44Q6V8/3myentn2VK75u47E0Lo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575143301; 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=KAnozijQnJ7jZgrp+o4jADOZ48ZvoJvjxYWiOwhxZ0o=; b=WGXzeWZjyi8kos/T+1UA4VNV+pJQ/nPdqVWRO2zSb72YTyZ50np0Nzi/Wjl8VAp4NU1kn8oVhzUngRkp5OiNa8WO3pGJ4F3mwdP1oc63AvJIGIVzWLHMEWBaW2efEzFL1mK7rFclw0gc+wnkaJ9dDttSnNGNrmFS7CB5X2nwJxk= 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 1575143301453206.07561094885216; Sat, 30 Nov 2019 11:48:21 -0800 (PST) Received: from localhost ([::1]:37678 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ib8j4-0003qq-Pu for importer@patchew.org; Sat, 30 Nov 2019 14:48:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53528) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ib8ds-0006Th-Ql for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:43:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ib8dq-00058h-Pi for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:42:56 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:59410 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 1ib8do-00055W-Qi for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:42:53 -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-172-n9TnEU-QOACEPD7fGMN2dQ-1; Sat, 30 Nov 2019 14:42:48 -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 B44D2DB21; Sat, 30 Nov 2019 19:42:47 +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 875F9600C1; Sat, 30 Nov 2019 19:42:47 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 1C9EF11366DF; Sat, 30 Nov 2019 20:42:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575142972; 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=KAnozijQnJ7jZgrp+o4jADOZ48ZvoJvjxYWiOwhxZ0o=; b=ISXPvnloOKBjC9rFPB2U2jeYnXhECgCo46BCZ7kaGV3XOvJSYebU451MBEtdTzVpFpJXvO 3QtKgMsKughv/lBz4dz8uUtyv2x7JCP2hgFYwfiImuBgGpGHm1YeG2/XANzoVcwtJZz9R+ TdhEBfXtsmjzTk585RCsrHfgyqWcSfU= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 07/21] tests: Clean up initialization of Error *err variables Date: Sat, 30 Nov 2019 20:42:26 +0100 Message-Id: <20191130194240.10517-8-armbru@redhat.com> In-Reply-To: <20191130194240.10517-1-armbru@redhat.com> References: <20191130194240.10517-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: n9TnEU-QOACEPD7fGMN2dQ-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: vsementsov@virtuozzo.com 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: Michael S. Tsirkin Reviewed-by: Vladimir Sementsov-Ogievskiy --- 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 Sat Apr 20 14:06:41 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=1575143655; cv=none; d=zohomail.com; s=zohoarc; b=R/sY8eZXvwZlks65NXFXevCLX097kh53WXxiOSaLr4HG/vx993W3d0l9yFWNPEpU+NrUaTcENxCvL7lsBWNAo0lmRqBUqST3X7FvC5cMgJWVr7Z/tD3p4ddpDvvOy8Xzs2XtBdfCB5NQ1MdgV6WAIKylPgZEjReSocWQRUQN94k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575143655; 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=Ui6GrgoIca+XbfoMtNNhuIbZOCAX//qMjn54wOZVwE0=; b=S4jH4+Z/a+76rJhwqFW+oBO/p8MfXsrCFFcn5oAiewWvOeC2cvc/38OBnlIUxch/TR3Op/y+09FPNrqb3GYdEvu/uC6ddX5BLfA9VBR0NZb4sttIVNPEGCPybu2NAM4otQ08W8QHvbn5htTrnw9TwWUir8liwVOzdhPHFffco38= 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 1575143655267491.1793896616206; Sat, 30 Nov 2019 11:54:15 -0800 (PST) Received: from localhost ([::1]:37746 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ib8on-00032x-U8 for importer@patchew.org; Sat, 30 Nov 2019 14:54:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53527) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ib8ds-0006Tg-Qh for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:43:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ib8dq-000593-Rj for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:42:56 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:44727 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 1ib8do-00055U-RT for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:42:54 -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-263-rIGtdbenONej9jLdE2_7DA-1; Sat, 30 Nov 2019 14:42:48 -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 B9A63107ACC4; Sat, 30 Nov 2019 19:42:47 +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 8ABFA5C219; Sat, 30 Nov 2019 19:42:47 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 1FDE611366E6; Sat, 30 Nov 2019 20:42:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575142972; 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=Ui6GrgoIca+XbfoMtNNhuIbZOCAX//qMjn54wOZVwE0=; b=i8x+bWHk/bEay8rChZ+/Wcnz78mjLGl55F1Cl9DigIi/wcVZfLbFVuynjUexWw4GSqd09p dbbvOSNbh/oDseodB24HxVamc4sFO/UtPWNBZOyXciLnsJFwn7TTINE+bvELuMFkwm3VLs MV4gyUO76PQU0QfoVx9luLhCh61+UnU= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 08/21] exec: Fix latent file_ram_alloc() error handling bug Date: Sat, 30 Nov 2019 20:42:27 +0100 Message-Id: <20191130194240.10517-9-armbru@redhat.com> In-Reply-To: <20191130194240.10517-1-armbru@redhat.com> References: <20191130194240.10517-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: rIGtdbenONej9jLdE2_7DA-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.81 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 , vsementsov@virtuozzo.com 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" 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). Messed up in commit 056b68af77 "fix qemu exit on memory hotplug when allocation fails at prealloc time". The bug can't bite as no caller actually passes null. Fix it anyway. Cc: Igor Mammedov Signed-off-by: Markus Armbruster Reviewed-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin --- 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 Sat Apr 20 14:06:41 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=1575143807; cv=none; d=zohomail.com; s=zohoarc; b=gQbGE9Tu3HJv74aEaQFo9XJgedE9FKf+tsPMBruFHxMga7SqkLYaDO46/84W9hpqANYFg8RosjZHfwh8JA2jqMiRpl8jguO7bpT82TaE7/GoEgVfsw0v6UKt5wJZUz9SrOTwOuiAl972BFJbw2+4aP1HV7klt4mYF9ETpjttvOs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575143807; 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=X9ohRhZMo4PHmP3e4xms+2hvoD8VFoiNZy3Ldir0HdM=; b=bO/nT/+DFJyI4/7a2jm9PJciRgTPNfo717qm0HU0E0sH6+318QOC5SHqLYQp9qEGzhGrFJv4TQKpkg6hjsGBgx/BYxAptnKq2ma7KouMEgObQC79JMNoMdVxo6aGOABy18eY2HfNItiv3DV3Y3+OOsWo9Ej7yXQPww1rOP2Ugq0= 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 1575143807970113.75407120176112; Sat, 30 Nov 2019 11:56:47 -0800 (PST) Received: from localhost ([::1]:37782 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ib8rG-0005ga-5I for importer@patchew.org; Sat, 30 Nov 2019 14:56:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53666) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ib8dx-0006ZB-AV for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:43:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ib8dv-0005Dg-30 for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:43:01 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:58791 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 1ib8du-00058P-NP for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:42:58 -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-416-WPtqNFc0MAiS_p9OoaEAfg-1; Sat, 30 Nov 2019 14:42:52 -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 C8B6480183D; Sat, 30 Nov 2019 19:42:51 +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 EC2115D6D6; Sat, 30 Nov 2019 19:42:48 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 2340A11366EC; Sat, 30 Nov 2019 20:42:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575142974; 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=X9ohRhZMo4PHmP3e4xms+2hvoD8VFoiNZy3Ldir0HdM=; b=eeSy0kdkA+bbWAoUd78/xvxkibviBfUDclG4MyCVT9G3ckA/gFhsRAfbGN00+0ehsu9nR+ t+ltbwqgEu2jTQ4ASnADU01Myz+EJvC4jPfrl+V6J1qZBXI8eoS9hnzXoaTtdfjhZu1tjk 0xG3XDd9UYn71fALP1dWyrKuB648iE4= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 09/21] hw/acpi: Fix latent legacy CPU plug error handling bug Date: Sat, 30 Nov 2019 20:42:28 +0100 Message-Id: <20191130194240.10517-10-armbru@redhat.com> In-Reply-To: <20191130194240.10517-1-armbru@redhat.com> References: <20191130194240.10517-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: WPtqNFc0MAiS_p9OoaEAfg-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 , vsementsov@virtuozzo.com, "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() crashes when acpi_set_cpu_present_bit() fails and its @errp argument is null. Messed up in commit cc43364de7 "acpi/cpu-hotplug: introduce helper function to keep bit setting in one place". The bug can't bite as no caller actually passes null, and acpi_set_cpu_present_bit() can't actually fail. Fix it anyway. 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 Sat Apr 20 14:06:41 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=1575143369; cv=none; d=zohomail.com; s=zohoarc; b=GNS3uxttoPDG8ihgxqoVFoi7ERUF/XKTTRp8wQsKkvjJsOf97OFv7HPh9RNK8cucetWefOLdEYFeDOf4FIFEYXt6AUQ29eUfxWVQERlIYRnG26MO01P6h07w69E6SqCeAdFT9KgR0Fx6HJUfkJmZs8N/p2zJXbhBo1u0JZ21jqA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575143369; 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=kRKNw1DGxjyDjzaLKcSU2qGKWJyyolVCSyH6uayqbcM=; b=lAAZlCU35Mea1HbSV5CJf2CJbKjk9p/4f3XkmhYeLzcT7PGwGmjUgkQJa6m25ep7LmQF1EUyiCxhdepM6vOBY7+9LBVWeyQm1Q6EJWbfFalkqiotmaELF+4CjzJLd4Mzmju81tjemgBwte0Kg5o5ryICqwQH4OeqmtR9a5pFWa0= 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 1575143369057999.7721035836956; Sat, 30 Nov 2019 11:49:29 -0800 (PST) Received: from localhost ([::1]:37684 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ib8kB-00058y-KL for importer@patchew.org; Sat, 30 Nov 2019 14:49:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53557) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ib8du-0006Ug-LI for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:43:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ib8ds-0005BO-PU for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:42:58 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:21943 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 1ib8dq-000572-QQ for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:42:56 -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-299-eB47qqh7M8uHcTaxg42vVQ-1; Sat, 30 Nov 2019 14:42:50 -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 2A914800D4E; Sat, 30 Nov 2019 19:42:49 +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 EFAEA5D9E1; Sat, 30 Nov 2019 19:42:48 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 2675D11366F1; Sat, 30 Nov 2019 20:42:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575142973; 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=kRKNw1DGxjyDjzaLKcSU2qGKWJyyolVCSyH6uayqbcM=; b=SE4VSPALqjk1leivEw7G6OuZwKCx5c3HEUZwYYvaZAvfqbxk4sbEUafQU3mCjHeMiFL1Ix aeJ3GKnSyyVpAatmKMfIRewsocFWoeoxxPChFdnm6m2m+AL7qZsDK2P9kMWYxEy/o7LU/g RmZacnCtuagHZDJPVCPZbPj1OKoZp6A= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 10/21] hw/core: Fix latent fit_load_fdt() error handling bug Date: Sat, 30 Nov 2019 20:42:29 +0100 Message-Id: <20191130194240.10517-11-armbru@redhat.com> In-Reply-To: <20191130194240.10517-1-armbru@redhat.com> References: <20191130194240.10517-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: eB47qqh7M8uHcTaxg42vVQ-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.81 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: vsementsov@virtuozzo.com 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() recovers from fit_image_addr() failing with ENOENT. Except it doesn't when its @errp argument is &error_fatal or &error_abort, because it blindly passes @errp to fit_image_addr(). Messed up in commit 3eb99edb48 "loader-fit: Wean off error_printf()". The bug can't bite as no caller actually passes &error_fatal or &error_abort. Fix it anyway. Signed-off-by: Markus Armbruster Reviewed-by: Michael S. Tsirkin Reviewed-by: Vladimir Sementsov-Ogievskiy --- 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 Sat Apr 20 14:06:41 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=1575143733; cv=none; d=zohomail.com; s=zohoarc; b=T5DGLjXTXQbYbw6H0QwyTnRM3OWq3ZFuPw7Ly4Rld3egsHqFHr7TQ/z7r/0YGS822K3a2fwyx7d1iXQaa59J0neZJD9sso+chLlhCEFaXaBnaRHH0yFWeTxCtKttPrYnTzGCSOog4hz/Vr0nCdnL08bE5L1vQN7s1XhQMAhgtUA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575143733; 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=3t/HhgZjzhBdRwBHKCZ+80RD28r4jF7bHY7IRHnb69k=; b=J8TH2T8Sh+P5Svl0YHJeu6ReIPEZv75332wLc+me2i4EEQex0P9j2UGcWB11u4aAldDff8dAeMpfJTMDpo8cPv7otQYp8rHVU++favMHiGtHAUt36AvWi+BIxl79fQGAGGIqmSqG8nNyaAOBEZGg5sCRgHZfwkXFEAEN+XlulE4= 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 1575143733485228.45876130990177; Sat, 30 Nov 2019 11:55:33 -0800 (PST) Received: from localhost ([::1]:37752 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ib8q4-0003qo-5k for importer@patchew.org; Sat, 30 Nov 2019 14:55:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53690) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ib8dx-0006aB-SO for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:43:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ib8du-0005Cz-MU for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:43:01 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:29590 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 1ib8ds-000578-Oz for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:42:58 -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-366-YSDmZVBYMWe0y6c7WTE_LQ-1; Sat, 30 Nov 2019 14:42:50 -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 2A1F210054E3; Sat, 30 Nov 2019 19:42:49 +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 EE96819C58; Sat, 30 Nov 2019 19:42:48 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 29B2A11366F2; Sat, 30 Nov 2019 20:42:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575142973; 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=3t/HhgZjzhBdRwBHKCZ+80RD28r4jF7bHY7IRHnb69k=; b=eRMgFg7Rq3sdymqbRdb5i9H8x7ri+4DviFyB7XDLKKYxvJkmwQrZLcQtvwCAozcgx1ytJc phuwWFdmCA3xxzcW4mmELA2/EY1areFZY/aUpZG2WxQpiBakz0dYpGqr7m7vWkayDoG8lC CihwLqJ1R+oSTGMA8MRuDjxXOI9f/ks= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 11/21] hw/ipmi: Fix latent realize() error handling bugs Date: Sat, 30 Nov 2019 20:42:30 +0100 Message-Id: <20191130194240.10517-12-armbru@redhat.com> In-Reply-To: <20191130194240.10517-1-armbru@redhat.com> References: <20191130194240.10517-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: YSDmZVBYMWe0y6c7WTE_LQ-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: Corey Minyard , vsementsov@virtuozzo.com 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" isa_ipmi_bt_realize(), ipmi_isa_realize(), pci_ipmi_bt_realize(), and pci_ipmi_kcs_realize() crash when IPMIInterfaceClass method init() fails and their @errp argument is null. First messed up 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". The bug can't bite as no caller actually passes null, and none of the init() methods can actually fail. Fix it anyway. Cc: Corey Minyard Signed-off-by: Markus Armbruster Reviewed-by: Michael S. Tsirkin --- 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 Sat Apr 20 14:06:41 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=1575143487; cv=none; d=zohomail.com; s=zohoarc; b=n8O3REUq3FqpgoyMInQZ8unIqremmNmyCzVEvp1lGTqqxqOxoAeQWakfTOxl+o3pYr9DnjFj94kgDzOXl2IrXIsLrE2lpqTUsTBKQ6oMZcvXIzND++QicFHDkKE7PTDBsTel4aRU6Eu7E52F7L15sGhmmFp3Ru9GIk9H3tQvCDQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575143487; 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=6+WDpTr2l+S+ufHYzRrbqlPbh/3TDGw8iJU+PKCkrjo=; b=EU7Qs4gbAAsjcOLZ/riyKWw66oEm2ovJkyLWne3VD4rZHV3HvJlTbXKo+/oIlbpZSR+DXBXA2Y/kyUXA/PeyjMyhz677I5fHxpLWqZ8+4rAEpVt3Rw/lK3IZQVBGrxaqaJcr+jRRfV37xfxR4M0rtergUvdpfpZIxthcIfTCqso= 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 1575143487547671.055697399725; Sat, 30 Nov 2019 11:51:27 -0800 (PST) Received: from localhost ([::1]:37722 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ib8m5-0007vZ-KR for importer@patchew.org; Sat, 30 Nov 2019 14:51:25 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53637) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ib8dw-0006YD-Pa for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:43:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ib8du-0005Co-Lu for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:43:00 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:53230 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 1ib8dt-00056y-Sz for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:42:58 -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-192-xQaGg6W7MmW7h5WDQbly0Q-1; Sat, 30 Nov 2019 14:42:50 -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 2F84B80183C; Sat, 30 Nov 2019 19:42:49 +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 F3A6F5D6D8; Sat, 30 Nov 2019 19:42:48 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 2D12111366F3; Sat, 30 Nov 2019 20:42:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575142973; 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=6+WDpTr2l+S+ufHYzRrbqlPbh/3TDGw8iJU+PKCkrjo=; b=Ll7KZcHRfqNxPZNHs8Y5cb4izbiCW9BTQDGUFXLa3nz9m9VlmySK1UEgCsNANq9SAoM3Hz wKLgy//IDVv/qRbZghojZWJMMABC8wGRECEIbLHXu8lpWVJootKoDf0TX6L4YhFPbgwlHY GQBefCOwfGqRdpltQIJ5iM4k3wpSkEo= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 12/21] qga: Fix latent guest-get-fsinfo error handling bug Date: Sat, 30 Nov 2019 20:42:31 +0100 Message-Id: <20191130194240.10517-13-armbru@redhat.com> In-Reply-To: <20191130194240.10517-1-armbru@redhat.com> References: <20191130194240.10517-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: xQaGg6W7MmW7h5WDQbly0Q-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: vsementsov@virtuozzo.com, 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() crashes when build_guest_fsinfo_for_device() fails and its @errp argument is null. Messed up in commit 46d4c5723e "qga: Add guest-get-fsinfo command". The bug can't bite as no caller actually passes null. Fix it anyway. Cc: Michael Roth Signed-off-by: Markus Armbruster Reviewed-by: Michael S. Tsirkin Reviewed-by: Vladimir Sementsov-Ogievskiy --- 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 Sat Apr 20 14:06:41 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=1575144068; cv=none; d=zohomail.com; s=zohoarc; b=j1lB3d6Mc5tjGZ5kOaghJT4nB7hC3zgKlaxGvBVG4YpQBF+uunGqO5RdLgVh1T51AencxJZn1Y1Fp52hl9BkRRLqFpARbpFolarfxfSEptQO/4Z7hB3wyakaoUyOozGBG8PBoFRmYuvx18r4dsBklB8WTDaBYYvTCAdE3+XQuYs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575144068; 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=+dynwsHSBPSdNaS6/Bm4It61bKF8kebpsa7wwuPEPdY=; b=kCSiPwy0BchwUSbqH+jTCw9p7HoL/LpIZ8DeGcnFLli4M3DA1BkzEIYjM/Vv/SpV991CxtJRiaFXWNjEnDSbRwuPTFDOBaYXKSv1MgdGJq03M5hx65u75nI57ILnXZ/gRxCiiNvnVf5v89vzemSjw87HadlRX+R9HTr2dwTaBFY= 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 1575144068140330.0318475889799; Sat, 30 Nov 2019 12:01:08 -0800 (PST) Received: from localhost ([::1]:37842 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ib8vS-0002U3-Pv for importer@patchew.org; Sat, 30 Nov 2019 15:01:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53640) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ib8dw-0006YM-V0 for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:43:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ib8dv-0005DV-2z for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:43:00 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:22916 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 1ib8du-0005Ac-PG for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:42:58 -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-212-NR7JGCSbN-OY7UmhITJ3Hw-1; Sat, 30 Nov 2019 14:42:52 -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 D2043800D41; Sat, 30 Nov 2019 19:42:51 +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 01AE05D70E; Sat, 30 Nov 2019 19:42:49 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 303D911366F7; Sat, 30 Nov 2019 20:42:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575142976; 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=+dynwsHSBPSdNaS6/Bm4It61bKF8kebpsa7wwuPEPdY=; b=fcTNGbe8DiozWQqV2fdR44aFfZcYzJn7M0ByUh9kw1YuCOu5y+NtU9FNotGOPPeHj+kOWG ghG+6gvPmosxmlSFWDtsw8O3r9y9ZHIakObF4vweY07xAETa6GGAt1bV1DyKQYoy8OrT0z zNTpFEnzhzJ06wrlczTkmn0LU6Ev4EQ= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 13/21] memory-device: Fix latent memory pre-plug error handling bugs Date: Sat, 30 Nov 2019 20:42:32 +0100 Message-Id: <20191130194240.10517-14-armbru@redhat.com> In-Reply-To: <20191130194240.10517-1-armbru@redhat.com> References: <20191130194240.10517-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: NR7JGCSbN-OY7UmhITJ3Hw-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: vsementsov@virtuozzo.com, 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() crashes when memory_device_check_addable() fails and its @errp argument is null. Messed up in commit 1b6d6af21b "pc-dimm: factor out capacity and slot checks into MemoryDevice". The bug can't bite as no caller actually passes null. Fix it anyway. Cc: David Hildenbrand Signed-off-by: Markus Armbruster Reviewed-by: David Hildenbrand Reviewed-by: Michael S. Tsirkin --- 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 Sat Apr 20 14:06:41 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=1575143812; cv=none; d=zohomail.com; s=zohoarc; b=G7h8Xl1dM+aGI+ccRYlKBnxAKPGt7+4XyxhOcc2TrW9S7NGz6JCRupAE0uTXruuCG5K6fEmFtwN/MAGyX+q4lhPBTeDs1+puDyvUh8T8MaQhosKsRhyF443WC9xhUVS1iJsZCFUkRKLYGkckDXt02OPhlwZItQq/SSgNNdJgl5Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575143812; 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=g6s54Yx9MNo545FwLDDs16iRJ9KAV1CQQ70D0Qc5Xbg=; b=IVg7e6MUR7uIUJeXVL5koWIGZ3OiMLTwqwTNKYtzowH5PXIjH7Hjh5jXkmRBGDzskqnBXVFVGPkwOOoI4qfCMv6HESX56QvBbDH/HOKkYNOAFI8Xoc8In3qWHHGw/7eUW9Yg8b9p4+gBKtG5+0DFkh8F+9rEl321tWpXmoNSRHQ= 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 1575143812121466.31073976262223; Sat, 30 Nov 2019 11:56:52 -0800 (PST) Received: from localhost ([::1]:37784 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ib8rK-0005n8-FZ for importer@patchew.org; Sat, 30 Nov 2019 14:56:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53597) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ib8dv-0006Wf-T5 for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:43:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ib8du-0005Cp-Lr for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:42:59 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:40440 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 1ib8ds-0005Ab-O5 for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:42:58 -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-212-20_MptBPOImtUrb2Gi73Ew-1; Sat, 30 Nov 2019 14:42:52 -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 EF9FB184CAB8; Sat, 30 Nov 2019 19:42:51 +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 063AB19C5B; Sat, 30 Nov 2019 19:42:49 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 33716113639C; Sat, 30 Nov 2019 20:42:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575142976; 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=g6s54Yx9MNo545FwLDDs16iRJ9KAV1CQQ70D0Qc5Xbg=; b=aZQyXUqxekN8ylM+kM9rNRss1jN2iiZncEpvW9/64w2QhGhE/qjKgzzDqW+gaIHxop1Zdy gv1SfxcIZp9rP4CyMHuP3SpGXcYzTdiIkyDhj+SqkHEZekRAwu2tEEdTU/RtQTfBPXhIeT ICHqx2eWpUEnawUkq41vduajxL6gblY= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 14/21] s390x/event-facility: Fix latent realize() error handling bug Date: Sat, 30 Nov 2019 20:42:33 +0100 Message-Id: <20191130194240.10517-15-armbru@redhat.com> In-Reply-To: <20191130194240.10517-1-armbru@redhat.com> References: <20191130194240.10517-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: 20_MptBPOImtUrb2Gi73Ew-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 , vsementsov@virtuozzo.com, 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() crashes when object_property_set_bool() fails and its @errp argument is null. Messed up in commit f6102c329c "s390/sclp: rework sclp event facility initialization + device realization". The bug can't bite as no caller actually passes null. Fix it anyway. Cc: David Hildenbrand Cc: Cornelia Huck Signed-off-by: Markus Armbruster Reviewed-by: David Hildenbrand Reviewed-by: Michael S. Tsirkin --- 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 Sat Apr 20 14:06:41 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=1575143532; cv=none; d=zohomail.com; s=zohoarc; b=Od0GtbcwRCdMfoyz3Y6e1qveBL01ILV6AhUEe+18zcZLH555ndEqRMJ6BNVDxP14vofCL2pwHjI6RksUhpBabfG1gM+FEcf37n+48YdZXN1oC9yG37OVC976L/kcMU4m7M7APjKPlnEHce/9742FqVnHjVVUs3HvONBOwrbaLgo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575143532; 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=XKOFNJ7AKoAjW1m5Bz8AzZ1gisR6NMx4PnfY9PjImjo=; b=H7Y8tLizQB4SQWQaUaKpY51mGRckUdccIYelIbraC6Lv90Gwo5G/E9AloBGHSwZ8kMosJ0sFk3QRsLPp/FgLkQAEQw4ORY7VIz8hUuogUUmedIIRRoLM7Cd08hCB2EIkGBoVYALs08t4iHaHpTAIh44eGPnBiCxhTt/j9ijoi74= 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 1575143532136168.23172933906937; Sat, 30 Nov 2019 11:52:12 -0800 (PST) Received: from localhost ([::1]:37726 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ib8mo-0000a9-Ee for importer@patchew.org; Sat, 30 Nov 2019 14:52:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53604) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ib8dw-0006X5-8v for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:43:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ib8dv-0005DP-2B for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:43:00 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:51061 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 1ib8du-00058G-MK for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:42:58 -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-24-woFdMWQ7PjWaBHd1tkYDmg-1; Sat, 30 Nov 2019 14:42:52 -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 E2611800D4E; Sat, 30 Nov 2019 19:42:51 +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 0A18D600C1; Sat, 30 Nov 2019 19:42:49 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 36A201135A56; Sat, 30 Nov 2019 20:42:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575142974; 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=XKOFNJ7AKoAjW1m5Bz8AzZ1gisR6NMx4PnfY9PjImjo=; b=Sk7mbq8uLtDNw0dOLDyNggIIUhjTvk64G4UPcZR9rF/kA81Pk47S04XfSjVUY3khWJbeRi X3v26Wh7JRd4MF/ACkpx00wT1EpIkI8STgbiJ+xt1UFPr6Ba6taC1Pd3ono8XPRlw0oZTs jeL5AKwhis0yWoL1sO06GoLd0wnoVoI= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 15/21] s390x/cpu_models: Fix latent feature property error handling bugs Date: Sat, 30 Nov 2019 20:42:34 +0100 Message-Id: <20191130194240.10517-16-armbru@redhat.com> In-Reply-To: <20191130194240.10517-1-armbru@redhat.com> References: <20191130194240.10517-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: woFdMWQ7PjWaBHd1tkYDmg-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 , vsementsov@virtuozzo.com, 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() crash when the visitor fails and its @errp argument is null. Messed up in commit 0754f60429 "s390x/cpumodel: expose features and feature groups as properties". The bug can't bite as no caller actually passes null. Fix it anyway. Cc: David Hildenbrand Cc: Cornelia Huck Signed-off-by: Markus Armbruster Reviewed-by: David Hildenbrand Reviewed-by: Michael S. Tsirkin --- 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 Sat Apr 20 14:06:41 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=1575143652; cv=none; d=zohomail.com; s=zohoarc; b=jJsa3N7exglWSKopYEn/B/OeRmYBNHOozaKHVVgvwi3gEWpbFlJ4vfPC+gb9ioiW82nRk29MguydB2eKyyulPUEbz+sQsEYYtgZ5p+67g4x5ceTBXdwzwA+lDaG8aeMS0p94iVY4Vg1k9FEQ38qt6aigfDvboNVauZbN20f1eKU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575143652; 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=bfhZK4iK/fF9bpGJNPVZYuytDwS0kE2F3pxBsnKfuA4=; b=K9/B5omFYixUI747HC1KPP063vKPCMp2P74i65rAeJ1tlzsQYGiyNnz6CljT8z16I4f6mk+SGMaRvbXEwkV+HFr08wMm3U40Vrp35yyCAgBPc0iyDFn4KZesfCudenm2rnKc/KnYr9nEV6FcpsBr4aENX4nyqL5x2EalJ5Z0jz8= 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 1575143652316575.1708254210852; Sat, 30 Nov 2019 11:54:12 -0800 (PST) Received: from localhost ([::1]:37744 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ib8ol-0002wr-20 for importer@patchew.org; Sat, 30 Nov 2019 14:54:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53656) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ib8dx-0006Yd-2j for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:43:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ib8du-0005Cd-L3 for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:43:00 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:32999 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 1ib8ds-000589-NS for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:42:58 -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-416-XFitOcfoPxKm5THbQYyfdA-1; Sat, 30 Nov 2019 14:42:52 -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 E0EC7DB20; Sat, 30 Nov 2019 19:42:51 +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 0F0181001281; Sat, 30 Nov 2019 19:42:49 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 39DD61135A59; Sat, 30 Nov 2019 20:42:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575142974; 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=bfhZK4iK/fF9bpGJNPVZYuytDwS0kE2F3pxBsnKfuA4=; b=eeatA2yjt1dcegqDycNrw6qtMvnubZAuew6ABKtFKGQlJUl/2pf0evslqNytd/a7HsbjcU 3TjGhQ7zNjtpnt9Y/Q6eqi1wWULS9DKiVHW9GnD/7+QLDe/9Ou6LxU9iigXRFpQ8pn56HD F0u98F/99vrTC53nVXuu7v4pPAi/O/c= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 16/21] s390/cpu_modules: Fix latent realize() error handling bugs Date: Sat, 30 Nov 2019 20:42:35 +0100 Message-Id: <20191130194240.10517-17-armbru@redhat.com> In-Reply-To: <20191130194240.10517-1-armbru@redhat.com> References: <20191130194240.10517-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: XFitOcfoPxKm5THbQYyfdA-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 , vsementsov@virtuozzo.com, 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() crashes when kvm_s390_get_host_cpu_model() fails and its @errp argument is null. apply_cpu_model() crashes when kvm_s390_apply_cpu_model() fails and its @errp argument is null. s390_realize_cpu_model() crashes when get_max_cpu_model() or check_compatibility() fail, and its @errp argument is null. All three messed up in commit 80560137cf "s390x/cpumodel: check and apply the CPU model". The bugs can't bite as no caller actually passes null. Fix them anyway. Cc: David Hildenbrand Cc: Cornelia Huck Signed-off-by: Markus Armbruster Reviewed-by: David Hildenbrand Reviewed-by: Michael S. Tsirkin --- 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 Sat Apr 20 14:06:41 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=1575144157; cv=none; d=zohomail.com; s=zohoarc; b=iktIi3Ef5ihn2uuGre7k3Bwj7yvw0y0HqY+jaBbJGikvw8wfSwS2WQ9Q99rmZfbJcLbzL9qxNVpyF+Yw++aQLaG7vXKJzVO2OBjg26sBjry3nV20BQFgE5mKVW1VMeaBtJ+JuGvj4GHm1Kkm7qbWvuuYIIVbHgTD3gEJNLfGO3I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575144157; 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=lwveq/Hd1QbJmTtcX2t0aVbraIXH0lWuf5V+vTtMWvM=; b=W8ZEtfgNq937h6QCDzlltMf3QbhgJ8q/b6g4oXmxeuZ4umGPrWXxWQgIomjao9Sd/3lQO+kqqMYTyh7OK090BDwOIk0tR/NktAmSs3zGsi6kfBbCOrjV6APk2oijre4OS3NvawhJbqi/HTTszh92/E/ZpHE2Pr8owHpDf7z/q9o= 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 1575144157875728.5464348192029; Sat, 30 Nov 2019 12:02:37 -0800 (PST) Received: from localhost ([::1]:37878 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ib8wu-0003yp-5g for importer@patchew.org; Sat, 30 Nov 2019 15:02:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53682) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ib8dx-0006Zv-Jx for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:43:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ib8dv-0005DX-2X for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:43:01 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:23562 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 1ib8du-00058t-M8 for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:42:58 -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-266-2qicZGfxP_KjNJUjYTuOFQ-1; Sat, 30 Nov 2019 14:42:51 -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 7A4721005502; Sat, 30 Nov 2019 19:42:50 +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 22A74611DB; Sat, 30 Nov 2019 19:42:50 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 3D2E81135A5A; Sat, 30 Nov 2019 20:42:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575142974; 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=lwveq/Hd1QbJmTtcX2t0aVbraIXH0lWuf5V+vTtMWvM=; b=TACeyDGHsd9S/0cmzE+f7QHTx4spedE5eOcV4bOzfofw+4q4gyQqzxOKvLOtyl0NltBbLY 2cE0ti+lrmMurjuTAhpkPMDQS3guFqRZdk9KojiiXDapwf1g2XWW2A6pcs8vb8V6Be2mFe BNfiWBxYqkYo7bXWimun6k4Z97qKKeU= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 17/21] s390x: Fix latent query-cpu-model-FOO error handling bugs Date: Sat, 30 Nov 2019 20:42:36 +0100 Message-Id: <20191130194240.10517-18-armbru@redhat.com> In-Reply-To: <20191130194240.10517-1-armbru@redhat.com> References: <20191130194240.10517-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: 2qicZGfxP_KjNJUjYTuOFQ-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 , vsementsov@virtuozzo.com, 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 crashes when the visitor or the QOM setter fails, and its @errp argument is null. Messed up in commit 137974cea3 's390x/cpumodel: implement QMP interface "query-cpu-model-expansion"'. Its three callers have the same bug. Messed up in commit 4e82ef0502 's390x/cpumodel: implement QMP interface "query-cpu-model-comparison"' and commit f1a47d08ef 's390x/cpumodel: implement QMP interface "query-cpu-model-baseline"'. The bugs can't bite as no caller actually passes null. Fix them anyway. Cc: David Hildenbrand Cc: Cornelia Huck Signed-off-by: Markus Armbruster Reviewed-by: David Hildenbrand Reviewed-by: Michael S. Tsirkin --- 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 Sat Apr 20 14:06:41 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=1575143313; cv=none; d=zohomail.com; s=zohoarc; b=nGR/yRLOnuee3EEbM6GvRwLUQM/weX+TdwBN3X2gAImXRNMAVfesCFdOD3pSWPhxjwfMqi5WJYavJ5v4u5Iq1/r1hCEiZ15WT0gRiJWRihbeFlEoJP68RWOuO8N9ewJXyiInzv+0Av6V9sfXfK7IIIU8kOvd7hjGOKT/KU/iIO8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575143313; 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=IzScTi0f13u/09c3vl32cClyMnYp+cJJAy0b4UZrYmo=; b=g0Na3QmiW/xKhensqjyV+jVAuRtwX3hLfV9ybFjsSwPl+NP2MLnApVUKsI2/qDOlmP2tfjE77fy9sN+8MVrslvm9wcznc+sCZO/6pn042Dglp/1qTALZqC10AaZms7fxQI9dCHtXsxJtvHHBGldM/pAR0SBuHEZQ8YyxaHJj+Oo= 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 1575143313021505.96615494839523; Sat, 30 Nov 2019 11:48:33 -0800 (PST) Received: from localhost ([::1]:37682 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ib8jH-0004DQ-9h for importer@patchew.org; Sat, 30 Nov 2019 14:48:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53667) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ib8dx-0006ZC-CM for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:43:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ib8dv-0005Dn-4q for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:43:01 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:49538 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 1ib8du-0005Bg-T9 for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:42:59 -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-211-FHyFTlptOQKGHPVuX3yJ6w-1; Sat, 30 Nov 2019 14:42:53 -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 7BBC110054E3; Sat, 30 Nov 2019 19:42:52 +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 2C3375D9E1; Sat, 30 Nov 2019 19:42:50 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 40B921135A63; Sat, 30 Nov 2019 20:42:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575142976; 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=IzScTi0f13u/09c3vl32cClyMnYp+cJJAy0b4UZrYmo=; b=h0E4Fm6tu0IHKU6MCkLg73OojrGv0DGeVy/WCgb5OQt+TCrSTucjcW2cq/dbhT5POK3cuY DNF0cC92ZSpUB22nCW8UHHpN0EImP1PS3h9jbhXX1iqkj6YxULWXbLSX9lBh4Y2EebQMM7 oP/pNQRiDVYzX8m9oY0BDNwNApSmEAA= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 18/21] s390x: Fix latent query-cpu-definitions error handling bug Date: Sat, 30 Nov 2019 20:42:37 +0100 Message-Id: <20191130194240.10517-19-armbru@redhat.com> In-Reply-To: <20191130194240.10517-1-armbru@redhat.com> References: <20191130194240.10517-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: FHyFTlptOQKGHPVuX3yJ6w-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: Cornelia Huck , vsementsov@virtuozzo.com, 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() tries to ignore get_max_cpu_model()'s errors. However, it crashes when its @errp argument is null or &error_abort, and exit(1)s when it's &error_fatal. Messed up in commit 38cba1f4d8 "s390x: return unavailable features via query-cpu-definitions". The bug can't bite as no caller actually passes such @errp values. Fix it anyway. Cc: David Hildenbrand Cc: Cornelia Huck Signed-off-by: Markus Armbruster Reviewed-by: David Hildenbrand Reviewed-by: Michael S. Tsirkin --- 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 Sat Apr 20 14:06:41 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=1575143116; cv=none; d=zohomail.com; s=zohoarc; b=bRB156f5Xsknzdtd8UtLvHlVNheCR5FyEXGnjN0YaLh83g2NoT4gqIAAc+y+xyUJhW7kusgGF2RcjhVjsh9BXQDEeB56VCr726eSI05CFh5tTpcByV1TmltFtUlXxvkVhl0o8zUY0gKMA3OPQC7HCyf5ICvZyOwXcXTxXjfvOsw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575143116; 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=9Y98JwQw/Ngdi+JlWevYq0UaxfD8K8BRDlr37ANqfxo=; b=QKbUVha4y2ynr8XAuOaLiouNp8dy4ostnEPaiNw1CQEC/COQl6esKzSC5SVTtCKs+bSWHw9dhsNZ8PwlH86/yJU2ThErgaok4y3/31sklD8YEo/SloLqJ0lVZztSwhWszDO357S6R0AkEKrk0kaDmK5U0Mi/sInvO87iYwbgCOU= 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 1575143116616903.4037265337432; Sat, 30 Nov 2019 11:45:16 -0800 (PST) Received: from localhost ([::1]:37640 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ib8g7-0008Mb-A4 for importer@patchew.org; Sat, 30 Nov 2019 14:45:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53556) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ib8du-0006Uf-LB for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:43:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ib8ds-0005B9-O5 for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:42:58 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:38178 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 1ib8dq-000583-Q8 for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:42:55 -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-261-TKym0NMzNS-6YutoBI-FHA-1; Sat, 30 Nov 2019 14:42:51 -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 8B480107ACC4; Sat, 30 Nov 2019 19:42:50 +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 31681600C8; Sat, 30 Nov 2019 19:42:50 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 43FC71135A64; Sat, 30 Nov 2019 20:42:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575142974; 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=9Y98JwQw/Ngdi+JlWevYq0UaxfD8K8BRDlr37ANqfxo=; b=OoWMLXONgggeLeXd0/G46ujpKTarp2JxnTPuTUFlvPhdLGX+Hc8UJFIAh/J8kMu5UfBzZa fUE7ZZCdCXv0wirA1vDAQ1z4vyopNghTsED3OqYx9MkcM+0b5ks/EwXrVUd3//nESY3IHt SNIQJ+2AmTIUR+4dSYaP28no+wuFd6Y= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 19/21] error: Clean up unusual names of Error * variables Date: Sat, 30 Nov 2019 20:42:38 +0100 Message-Id: <20191130194240.10517-20-armbru@redhat.com> In-Reply-To: <20191130194240.10517-1-armbru@redhat.com> References: <20191130194240.10517-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: TKym0NMzNS-6YutoBI-FHA-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: vsementsov@virtuozzo.com 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: Michael S. Tsirkin 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 Sat Apr 20 14:06:41 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=1575144064; cv=none; d=zohomail.com; s=zohoarc; b=JcSylJocnwwnbGKyhWuRqK9OgX0yLK9shoUGz9jHKS6iqDMzXWsQCdQkkli2Ky1iaNfzbBI/GgwI/ntUxirgrQiKrRadl56A88RlkLl9i1ob6oqnXI6bCbNSDShP1s5HiAXncgTua+Yp+eD2diiJFmuFRX0j9Cff+TsS4imXZM8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575144064; 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=+6r20tme1c3K1oItK55VjhZNP4i1wewMOCLwqCimvoE=; b=c558lKC9+LNYk2NVt1/nC1mNiOhIQot5gUmMHUYitrxUBm48bIkOAO2rSwSwAjGv5SqG1dOKMhqj9U9ZHRmp/0gtWbPXnr3RFJI+jr0ThViC6c93R0DYG0Cquf8vLoozcs6gb0NbxPuTL2dKcRWgr1F0DS53hhLjM4vdFeKwIVI= 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 1575144064891874.6006616618638; Sat, 30 Nov 2019 12:01:04 -0800 (PST) Received: from localhost ([::1]:37840 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ib8vO-0002Ox-5r for importer@patchew.org; Sat, 30 Nov 2019 15:01:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53673) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ib8dx-0006ZU-DQ for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:43:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ib8dv-0005Dz-5F for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:43:01 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:49912 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 1ib8du-0005An-U7 for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:42:59 -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-266-tflcyL6LMEmznqfwm4cVFg-1; Sat, 30 Nov 2019 14:42:51 -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 66772DB21; Sat, 30 Nov 2019 19:42:50 +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 354586608A; Sat, 30 Nov 2019 19:42:50 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 487DE1135A70; Sat, 30 Nov 2019 20:42:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575142976; 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=+6r20tme1c3K1oItK55VjhZNP4i1wewMOCLwqCimvoE=; b=PRRBV4WR4pKNXKfHpcYILi1xHZ8qSIi9QKplOISlVIeX++2h/uAvNzntPdlXHHHvmiujLq bcE60AZ1OlvglGJ1Ys+Uq/x8dN/TJS/uiaiwEg1vu1ZZpsnMxshCKMkfXJtQljZygmOs8u SxqP+2CbhLZyD0z0+WOPEmkvCHWRNM0= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 20/21] hw/intc/s390: Simplify error handling in kvm_s390_flic_realize() Date: Sat, 30 Nov 2019 20:42:39 +0100 Message-Id: <20191130194240.10517-21-armbru@redhat.com> In-Reply-To: <20191130194240.10517-1-armbru@redhat.com> References: <20191130194240.10517-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: tflcyL6LMEmznqfwm4cVFg-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 , vsementsov@virtuozzo.com, 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 Acked-by: Halil Pasic Reviewed-by: Cornelia Huck Reviewed-by: Michael S. Tsirkin --- 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 Sat Apr 20 14:06:41 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=1575143911; cv=none; d=zohomail.com; s=zohoarc; b=Lb666gjs38TEAwv3e962DZi6N2lwpvMH7oXfPnkh3sK7aPC3dN6LF8VFU+6XN6dBYK6PshViMWCZr5r/DgN3iShrF41VAIwO0txh5674qYUCg/2aK+EsRe6324yLw9DN+C24V3XaHjtc0EJ0Toy4CqVw1f+6//iyZfDl6aU/lC0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575143911; 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=EWvrl1pKOWhXc6iPI2xLC14ZPehO6iBLbuWEKAUPc0E=; b=PIaqDSdnRrWGY+PAs7NH4qJOdDE56104ZYIvMEYeBq+O19gzOTqzBSG5KHXqmvkW4hqmz85NwOp4aCYD+Z5UJZxqyTLMypk4HX3/i73o5ez9zTmQ6Irg3D1vvq1EsIe3v2fHsWk4adO9JFHlcwqtt4ENQlIBsiFW6Nt8KcVr274= 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 1575143911591699.2776286946635; Sat, 30 Nov 2019 11:58:31 -0800 (PST) Received: from localhost ([::1]:37800 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ib8sw-0008Io-1T for importer@patchew.org; Sat, 30 Nov 2019 14:58:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53671) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ib8dx-0006ZQ-Du for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:43:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ib8dv-0005Ds-56 for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:43:01 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:43702 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 1ib8du-0005At-Tr for qemu-devel@nongnu.org; Sat, 30 Nov 2019 14:42:59 -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-289--thBDBbtPHudv2mPSAZVPA-1; Sat, 30 Nov 2019 14:42:51 -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 90B1A107ACC5; Sat, 30 Nov 2019 19:42:50 +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 63351600C9; Sat, 30 Nov 2019 19:42:50 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 4BA7011358A3; Sat, 30 Nov 2019 20:42:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575142976; 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=EWvrl1pKOWhXc6iPI2xLC14ZPehO6iBLbuWEKAUPc0E=; b=iz0PkQCjcyr5OGSGuAvHObYWPSefnhPOzBjNXPX1eiRhNqSsFuNDeXxHorsPmq6FA6LCwD UDjPfWV1FgXRO8zTNkJBL7KHTiz/gOsn9H/AhylBAgI+WZX4FvPqTP81gSZ08/UZsf3dnR nLXLt5r0YH9jPQwxcDgZTvauT4keUI8= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 21/21] tests-blockjob: Use error_free_or_abort() Date: Sat, 30 Nov 2019 20:42:40 +0100 Message-Id: <20191130194240.10517-22-armbru@redhat.com> In-Reply-To: <20191130194240.10517-1-armbru@redhat.com> References: <20191130194240.10517-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: -thBDBbtPHudv2mPSAZVPA-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: vsementsov@virtuozzo.com 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" Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Reviewed-by: Michael S. Tsirkin --- 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