From nobody Mon Feb 9 03:48:20 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1612186869; cv=none; d=zohomail.com; s=zohoarc; b=hSv9SzE4ryuYUOhyrIHZjVn6SKbOObPH6GTsw/YYua/IAMyv4iFuZmAe6H5suxQKlsPUDGz8BmJ4/eJpPq9SdROQvMFK6F8FLBhWg97UdwHoTt/0ZE7w8G0oWiSODg1RMkrcVEfnjrzZEsMaEnNG7Lg6pmPaFam+1lKpOejQLOg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612186869; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Ao7GOx39BZ+8YPvDDZgYRb+4GN2WV3OgksFPqONUgXY=; b=h5U00vkNWk6Uh/6UGj0xcKZ3rQA9KQ8Teh0Axp+ot7W+dzbN/PQ4GUeDAYs3CE7gr4rvGnJv0HhwQj5Lg+9qG2OB9/4vuQvnwIH8AMVX8UkszT7vPM2kAN08hAj3XtgaUUEXfDuJlRlhRkoHWiAxiYr+0WylI1U/REwYM0hj7DA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1612186869447186.223219426593; Mon, 1 Feb 2021 05:41:09 -0800 (PST) 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-559-Ml7RXHQbMnymO63YRfxYhA-1; Mon, 01 Feb 2021 08:39:30 -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 222EE800D53; Mon, 1 Feb 2021 13:39:25 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F3F7A39A66; Mon, 1 Feb 2021 13:39:24 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id BDBD55003F; Mon, 1 Feb 2021 13:39:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 111DdJIu023411 for ; Mon, 1 Feb 2021 08:39:19 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9005F60C68; Mon, 1 Feb 2021 13:39:19 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id EF63360C66 for ; Mon, 1 Feb 2021 13:39:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612186868; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Ao7GOx39BZ+8YPvDDZgYRb+4GN2WV3OgksFPqONUgXY=; b=REdi/pnON0/vUBNEmkBRukO3FCMzZxdHD3hXYpepmCU7uq6hdXr9SjFjX2SAg2Lh75jLUn OssqP5ufw3xzk7NbVaeSUmsdL7ZYRJAD86EW1SrHjeGauQYa++y7TpN55MYL7f4idBaPk1 SeOwJ0uWRH4BmDkC7CNo89D5o2pizL8= X-MC-Unique: Ml7RXHQbMnymO63YRfxYhA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 06/14] qemu: domain: Use memset for clearing secrets instead of VIR_DISPOSE_N Date: Mon, 1 Feb 2021 14:38:58 +0100 Message-Id: <31097c61a4ec7d1b77c61604b69c8b783f7d8da1.1612186636.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Phase out use of VIR_DISPOSE_N from the qemu driver. Use memset in the appropriate cases. Signed-off-by: Peter Krempa --- src/qemu/qemu_domain.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 2c34307c82..7f3f704bf4 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -443,7 +443,10 @@ qemuDomainMasterKeyFree(qemuDomainObjPrivatePtr priv) if (!priv->masterKey) return; - VIR_DISPOSE_N(priv->masterKey, priv->masterKeyLen); + if (priv->masterKey) { + memset(priv->masterKey, 0, priv->masterKeyLen); + g_clear_pointer(&priv->masterKey, g_free); + } } /* qemuDomainMasterKeyReadFile: @@ -584,7 +587,10 @@ static void qemuDomainSecretPlainClear(qemuDomainSecretPlainPtr secret) { VIR_FREE(secret->username); - VIR_DISPOSE_N(secret->secret, secret->secretlen); + if (secret->secret) { + memset(secret->secret, 0, secret->secretlen); + g_clear_pointer(&secret->secret, g_free); + } } @@ -1143,7 +1149,8 @@ qemuDomainSecretAESSetupFromSecret(qemuDomainObjPriva= tePtr priv, secinfo =3D qemuDomainSecretAESSetup(priv, alias, username, secret, se= cretlen); - VIR_DISPOSE_N(secret, secretlen); + memset(secret, 0, secretlen); + g_free(secret); return secinfo; } --=20 2.29.2