From nobody Tue Dec 16 13:49:46 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1743581386; cv=none; d=zohomail.com; s=zohoarc; b=kFzbYUYc4sOcrWxEEBsjPCI6FnvzLELgu4a6kz7uCdh55iq+SSVW40X2XWW7nDGcvH0f8urCOW2dkaAkd8pEhT+DPUrLawFhSZX0J99qwAhO4zlWJjsbKqCwYWXbfD/j4uid0qkpRuMC1Ih50wXzyHY1yS1v4/ylr7mj72GghDg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1743581386; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=/Z40udMRf0gcE2ipTOgEqWBNKzdF6Lg/WManq9l7n4c=; b=LWxcrSba07A0vI49obKKiJDi6oQGUpsI0Pgih2gwTQVWqdAMxTlpJQk4/e+RCZRo8Yd1bHkWif4MPAaU2GHLzmUPBvoh6NID69OgxdNSAAfXpDbj6hS2M2BQwyNU/SATpEkPAtY0Vc+qzWxSzPKINemKjkx8iUuP7VF3CHS8xmI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 174358138636340.72319507064128; Wed, 2 Apr 2025 01:09:46 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 61453132D; Wed, 2 Apr 2025 04:09:45 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 27F941401; Wed, 2 Apr 2025 04:08:43 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 45A8AE90; Wed, 2 Apr 2025 04:08:37 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id C2CF3E88 for ; Wed, 2 Apr 2025 04:08:36 -0400 (EDT) Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-637-xdxZXJJ0OlarADXioLRntA-1; Wed, 02 Apr 2025 04:08:35 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A8EE11828AD1 for ; Wed, 2 Apr 2025 08:08:34 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.8]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D32FB180A803 for ; Wed, 2 Apr 2025 08:08:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1743581316; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sPMfWIeJyg1H1PiOIEzACTwzZ7R4qf33xPzNdDJ54V4=; b=eiG7lWylC9k5m9/MfszV8z+Ljbe0Muux4jhSUUaORRK5uCZQ4jVXY7c0zCgT2R4ZDVGyD+ QfD7mtVhfvQZEVpkDawlzVkvxZlP1HZYCXE6+vuj0kqQ9mIxDad6f8P3SZuue/8e6fa6lK k8hmaKVUE1jQULHOoRmtLPVusK2fSbA= X-MC-Unique: xdxZXJJ0OlarADXioLRntA-1 X-Mimecast-MFC-AGG-ID: xdxZXJJ0OlarADXioLRntA_1743581314 To: devel@lists.libvirt.org Subject: [PATCH 2/6] qemuSnapshotCreateActiveInternal: Fix error logic Date: Wed, 2 Apr 2025 10:08:25 +0200 Message-ID: <3ec951634bbb36b09c6c1765a88fb8a2c9d3828a.1743580869.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: gkUh4uZhc9qTiM7glHE7JnMrCyXOTU81ofN-I3CM8EU_1743581314 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: FVAUPKGJQN2BSTENA3FVRVWUPWQL4EC7 X-Message-ID-Hash: FVAUPKGJQN2BSTENA3FVRVWUPWQL4EC7 X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: From: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1743581388305019100 Content-Type: text/plain; charset="utf-8" From: Peter Krempa The 'ret' variable is set to 0 before a call which can theoretically fail. Not in practice really as the failure scenarion includes only object initialization. Since the code already has another variable for checking monitor returns use that one properly so that the code makes sense. Signed-off-by: Peter Krempa --- src/qemu/qemu_snapshot.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index ac05156e17..4f914b385c 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -592,16 +592,15 @@ qemuSnapshotCreateActiveInternal(virQEMUDriver *drive= r, goto cleanup; } - ret =3D 0; } else { if (qemuDomainObjEnterMonitorAsync(vm, VIR_ASYNC_JOB_SNAPSHOT) < 0= ) { resume =3D false; goto cleanup; } - ret =3D qemuMonitorCreateSnapshot(priv->mon, snap->def->name); + rv =3D qemuMonitorCreateSnapshot(priv->mon, snap->def->name); qemuDomainObjExitMonitor(vm); - if (ret < 0) + if (rv < 0) goto cleanup; } @@ -617,6 +616,8 @@ qemuSnapshotCreateActiveInternal(virQEMUDriver *driver, resume =3D false; } + ret =3D 0; + cleanup: if (resume && virDomainObjIsActive(vm) && qemuProcessStartCPUs(driver, vm, --=20 2.49.0