From nobody Tue Apr 23 12:58:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) client-ip=63.128.21.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 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=1584636515; cv=none; d=zohomail.com; s=zohoarc; b=FEdNGLJeISgcTTtTLtSDx/hbFK6X3HCdIesW3APqvTvWeBGEA8iRZ5daYZE/qcRxgNtExvwAPoyXsoTun+pOhHI03BFi2fROYVOSHTSNlgmYqwGTfqvxI8eEN5HqJggZQuMRHSDCesE0dJLJFL2uLdGSopmWfW2vCHz3jAcrhTQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584636515; 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=fZiioaGqMoSnwPFtG4aZVHr6Wmqk/spi7P3Jri/FnDo=; b=EykBPcLzSKoglm0cw7s1n7M5SupAZ6WPDKSzOY40XaSVazzaWvRGfd34mqOTvSCE/zkmjH4tVMKDZRdfhTPf9bh3V2jjVE3GORlhUsQQfN3jF6hks3atPUulhThqcydT/fOba5Rri6O5LU0QvDCE/9Of7nFIRMZRPzoeodIZ+5w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 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-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by mx.zohomail.com with SMTPS id 1584636515630186.33342864130668; Thu, 19 Mar 2020 09:48:35 -0700 (PDT) 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-78-5pBVfDp_NrCwUgrE75BTDw-1; Thu, 19 Mar 2020 12:48:31 -0400 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 8501219251A4; Thu, 19 Mar 2020 16:48:23 +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 53B755417F; Thu, 19 Mar 2020 16:48:23 +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 DC21594291; Thu, 19 Mar 2020 16:48:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02JGmDG5015899 for ; Thu, 19 Mar 2020 12:48:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2AB09BBBCF; Thu, 19 Mar 2020 16:48:13 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id A40105C1A7 for ; Thu, 19 Mar 2020 16:48:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584636514; 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=fZiioaGqMoSnwPFtG4aZVHr6Wmqk/spi7P3Jri/FnDo=; b=ABHvo3dm/eTwMzDOcKh/0eK1eaG2fklDZUeuJfFUfJDGN1QBHvXAkJLoLFNkxnWNhS0pFq 0DffnKdNSa/XyQcs0bk//loDqzauXku7XJoyXHIba3ZlZ4The4OyKBMKREE4l6Pha/8f8n yH+TppOX1XNVRz/j10tnClKRF7DyxJQ= X-MC-Unique: 5pBVfDp_NrCwUgrE75BTDw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 1/2] virSecretLookupDefCopy: Remove return value Date: Thu, 19 Mar 2020 17:48:07 +0100 Message-Id: <6262a724b800456d57c7e2da9b512657c97a5016.1584636370.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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.15 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" The function always returns succes so there's no need for a return value. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/util/virsecret.c | 3 +-- src/util/virsecret.h | 4 ++-- src/util/virstoragefile.c | 3 +-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/util/virsecret.c b/src/util/virsecret.c index f44d964198..54d6bbcb7c 100644 --- a/src/util/virsecret.c +++ b/src/util/virsecret.c @@ -48,7 +48,7 @@ virSecretLookupDefClear(virSecretLookupTypeDefPtr def) } -int +void virSecretLookupDefCopy(virSecretLookupTypeDefPtr dst, const virSecretLookupTypeDef *src) { @@ -58,7 +58,6 @@ virSecretLookupDefCopy(virSecretLookupTypeDefPtr dst, } else if (dst->type =3D=3D VIR_SECRET_LOOKUP_TYPE_USAGE) { dst->u.usage =3D g_strdup(src->u.usage); } - return 0; } diff --git a/src/util/virsecret.h b/src/util/virsecret.h index 8c49cfbc89..cfdf2b6e29 100644 --- a/src/util/virsecret.h +++ b/src/util/virsecret.h @@ -48,8 +48,8 @@ struct _virSecretLookupTypeDef { }; void virSecretLookupDefClear(virSecretLookupTypeDefPtr def); -int virSecretLookupDefCopy(virSecretLookupTypeDefPtr dst, - const virSecretLookupTypeDef *src); +void virSecretLookupDefCopy(virSecretLookupTypeDefPtr dst, + const virSecretLookupTypeDef *src); int virSecretLookupParseSecret(xmlNodePtr secretnode, virSecretLookupTypeDefPtr def); void virSecretLookupFormatSecret(virBufferPtr buf, diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index 870c40f446..e723cc9410 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -1792,8 +1792,7 @@ virStorageAuthDefCopy(const virStorageAuthDef *src) authdef->secrettype =3D g_strdup(src->secrettype); authdef->authType =3D src->authType; - if (virSecretLookupDefCopy(&authdef->seclookupdef, &src->seclookupdef)= < 0) - return NULL; + virSecretLookupDefCopy(&authdef->seclookupdef, &src->seclookupdef); return g_steal_pointer(&authdef); } --=20 2.24.1 From nobody Tue Apr 23 12:58:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) client-ip=216.205.24.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 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=1584636505; cv=none; d=zohomail.com; s=zohoarc; b=blcrsu5gkYTU8sa2vrBBkOw/Iur7MQLafeaY92b8hJnxmsRxp3JMCk2mRASSt7J78Z7Bhkn5GD9A8bir9oX11M7KDxAb5R7R3WB0NHzwaxaSMFkkooy9XsfbocmZ99XAKRgsxLj+k3fwBwT9k7sDzd3ETv8dD9qsTmjZN5F4rwg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584636505; 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=qME0+q/HvNLG9vUH+6ROexaoGfgEglRq+340Coo0JJ0=; b=Jx3TmiETYpzNSWRmAqGxb3gw+I72a1TVZckZC2IIurjP0XhPMUQObjbphVwvT2tSNOzlbF2cuK50B0++1iNAaSysruqL8ChFrgjnoZhD4C5lLiKMG/oSoTj4TKyUDj82vLfLrG/PPGLtbs8Q0FShlmIbdjwMg2X04yJx44fo5Xc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 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-74.mimecast.com (us-smtp-delivery-74.mimecast.com [216.205.24.74]) by mx.zohomail.com with SMTPS id 1584636505893793.4351205351714; Thu, 19 Mar 2020 09:48:25 -0700 (PDT) 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-165-ewpUc6_3NhGNcI1BtZ7bAg-1; Thu, 19 Mar 2020 12:48:22 -0400 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 4A371800D50; Thu, 19 Mar 2020 16:48:16 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 02A4BBBBE9; Thu, 19 Mar 2020 16:48:16 +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 938ED18089C8; Thu, 19 Mar 2020 16:48:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02JGmEXS015906 for ; Thu, 19 Mar 2020 12:48:14 -0400 Received: by smtp.corp.redhat.com (Postfix) id 00872BBBCF; Thu, 19 Mar 2020 16:48:14 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7B1F45C1A4 for ; Thu, 19 Mar 2020 16:48:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584636504; 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=qME0+q/HvNLG9vUH+6ROexaoGfgEglRq+340Coo0JJ0=; b=TL0E0fTqVaYqp+ls4/+N3b6Qeb0uEMXdvclMd9Aj6EIX8FSEDbOW+UerJs1PvG0fLdTZZr n0sEzNavT5JAip4FYX4fg/CGhLsB22yxIJYm8PdYhUKu+j+ohY4fS6giCokLm8zUluaDsC efltcfE1rvBFEwQcxN71qSEutI0FLrc= X-MC-Unique: ewpUc6_3NhGNcI1BtZ7bAg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 2/2] virStorageEncryptionSecretCopy: Properly copy internals Date: Thu, 19 Mar 2020 17:48:08 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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.13 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" virStorageEncryptionSecretPtr may have a string inside it, thus we must copy the string too. Use virSecretLookupDefCopy to do that. Likely caused by 756b46ddd24. https://bugzilla.redhat.com/show_bug.cgi?id=3D1814923 Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/util/virstorageencryption.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/util/virstorageencryption.c b/src/util/virstorageencryptio= n.c index 74836d4a00..6765fdc23a 100644 --- a/src/util/virstorageencryption.c +++ b/src/util/virstorageencryption.c @@ -85,12 +85,10 @@ virStorageEncryptionFree(virStorageEncryptionPtr enc) static virStorageEncryptionSecretPtr virStorageEncryptionSecretCopy(const virStorageEncryptionSecret *src) { - virStorageEncryptionSecretPtr ret; - - if (VIR_ALLOC(ret) < 0) - return NULL; + virStorageEncryptionSecretPtr ret =3D g_new0(virStorageEncryptionSecre= t, 1); - memcpy(ret, src, sizeof(*src)); + ret->type =3D src->type; + virSecretLookupDefCopy(&ret->seclookupdef, &src->seclookupdef); return ret; } --=20 2.24.1