From nobody Fri Mar 29 11:47:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1602526504; cv=none; d=zohomail.com; s=zohoarc; b=gJipQBNLKv1aWR4KhYN5wtkNOk4PDNx77po7o8Je8sGxUxti0bYdW4+eBVh6Z88oL5IROdlNX8wMHstew//Afzwcuhe7EFrP+uyiIAt0mBMwI5n0/9S2osix+xd0m7PClPZoh8B3bjEOEDzM0y2kciNWFOaXwgIo2XeTgoUA+EM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602526504; 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=s1qzEp9Z1RjDRdwPL4ZzVNY2+WnOSBwrmPrQQNZfxy4=; b=eQGu7tAhpqz4XVIdLdfD1UUfXIaGpQFRPTuUaCeZPOycjeUKv+QBazZfDXuIPoTDtlof32xkGkoLES+z04wXrCP1HVHcK8zakTZ3WGuCyhwuRs9QvyleU+bchmYNz+2nBFxIhDnRyeoUxwPCg997Dw2lfaPkTJFn07F5g1aT8FE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.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 [63.128.21.124]) by mx.zohomail.com with SMTPS id 1602526504529589.2878390069246; Mon, 12 Oct 2020 11:15:04 -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-277-3B6ASPyQOy-KfNOzW8HviQ-1; Mon, 12 Oct 2020 14:14:02 -0400 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 53FEE1084D67; Mon, 12 Oct 2020 18:13:56 +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 D40B976665; Mon, 12 Oct 2020 18:13:55 +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 A0744183D024; Mon, 12 Oct 2020 18:13:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 09CIDYK8004795 for ; Mon, 12 Oct 2020 14:13:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1DCB41A92D; Mon, 12 Oct 2020 18:13:34 +0000 (UTC) Received: from antique-work.redhat.com (unknown [10.40.194.193]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8EC54277DC for ; Mon, 12 Oct 2020 18:13:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602526503; 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=s1qzEp9Z1RjDRdwPL4ZzVNY2+WnOSBwrmPrQQNZfxy4=; b=cEIXbhWMBmoYUFI9w0jGMD5cUW76RwEpEDBTpLLe0NVDVunPRow5yr9wzAhQmYd9kIcj4f 2Y34VOiQnABpPoo+zCjYYpKHMTV4n5P8SrhSltQNUl4tjabvdGXg7FFpYnPfJbLEBCWotC 9i84nOqM0P+83X3PC6PBEATQUyTtXzA= X-MC-Unique: 3B6ASPyQOy-KfNOzW8HviQ-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 1/2] conf: fix g_new0 allocation Date: Mon, 12 Oct 2020 20:13:28 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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" Fixes commit which changed allocation from VIR_ALLOC_N to g_new0 but missed some +1 on number of allocated elements. Signed-off-by: Pavel Hrdina Reviewed-by: Laine Stump --- src/conf/virinterfaceobj.c | 2 +- src/conf/virnetworkobj.c | 4 ++-- src/conf/virnodedeviceobj.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/conf/virinterfaceobj.c b/src/conf/virinterfaceobj.c index 5a5fd65e14..e08b4b9b0f 100644 --- a/src/conf/virinterfaceobj.c +++ b/src/conf/virinterfaceobj.c @@ -320,7 +320,7 @@ virInterfaceObjListExport(virConnectPtr conn, =20 virObjectRWLockRead(ifaceobjs); if (ifaces) - data.ifaces =3D g_new0(virInterfacePtr, virHashSize(ifaceobjs->obj= sName)); + data.ifaces =3D g_new0(virInterfacePtr, virHashSize(ifaceobjs->obj= sName) + 1); =20 virHashForEach(ifaceobjs->objsName, virInterfaceObjListExportCallback,= &data); =20 diff --git a/src/conf/virnetworkobj.c b/src/conf/virnetworkobj.c index 1fcfa9cdc2..a2835ebf8e 100644 --- a/src/conf/virnetworkobj.c +++ b/src/conf/virnetworkobj.c @@ -1407,7 +1407,7 @@ virNetworkObjListExport(virConnectPtr conn, =20 virObjectRWLockRead(netobjs); if (nets) - data.nets =3D g_new0(virNetworkPtr, virHashSize(netobjs->objs)); + data.nets =3D g_new0(virNetworkPtr, virHashSize(netobjs->objs) + 1= ); =20 virHashForEach(netobjs->objs, virNetworkObjListExportCallback, &data); =20 @@ -1801,7 +1801,7 @@ virNetworkObjPortListExport(virNetworkPtr net, if (ports) { *ports =3D NULL; =20 - data.ports =3D g_new0(virNetworkPortPtr, virHashSize(obj->ports)); + data.ports =3D g_new0(virNetworkPortPtr, virHashSize(obj->ports) += 1); } =20 virHashForEach(obj->ports, virNetworkObjPortListExportCallback, &data); diff --git a/src/conf/virnodedeviceobj.c b/src/conf/virnodedeviceobj.c index 28905c67b6..9af80b8036 100644 --- a/src/conf/virnodedeviceobj.c +++ b/src/conf/virnodedeviceobj.c @@ -931,7 +931,7 @@ virNodeDeviceObjListExport(virConnectPtr conn, =20 virObjectRWLockRead(devs); if (devices) - data.devices =3D g_new0(virNodeDevicePtr, virHashSize(devs->objs)); + data.devices =3D g_new0(virNodeDevicePtr, virHashSize(devs->objs) = + 1); =20 virHashForEach(devs->objs, virNodeDeviceObjListExportCallback, &data); virObjectRWUnlock(devs); --=20 2.26.2 From nobody Fri Mar 29 11:47:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1602526429; cv=none; d=zohomail.com; s=zohoarc; b=nJHL7ayM11KfQSY3wkYxaCHfVYjejamnbvGkxPaQbu2JdPRaNRNL77PyETh0P2G6Aw2bTua2196PUFTW/Zd2Mf2CqLZGeixFvXiXIIhiCxus4PF4Q6mbOPtZ2YuX8V68PZuZDUTXNMjbEs2gxpiQ1/nAdhZptV/KCOzPmiOwi8k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602526429; 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=qgh0Zy+PMbau3BFl5SOMMRWiP0b7yfGqbC6v1ico80E=; b=BGVwdfDNlWPmnNogGVsMCCAiQmN+O1qBUrVrfCb+/noTieClS29rIl9vL7ew+Bfn5PDaAvlzMTxf+mNaK3lxIfOZANPvm3aiextYlsHqBJVJM24kDIgsv5wsiTDMIrJkxlmDiisFeNN8ECkh/3z+24GINUcZUaSfJP8xLnJq53I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.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 [63.128.21.124]) by mx.zohomail.com with SMTPS id 1602526429472806.1078437214305; Mon, 12 Oct 2020 11:13:49 -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-484-BBsjRHDaMi-kxtGD7rPWsA-1; Mon, 12 Oct 2020 14:13:46 -0400 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 806321084D63; Mon, 12 Oct 2020 18:13:40 +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 EB370100164C; Mon, 12 Oct 2020 18:13:39 +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 21E42183D020; Mon, 12 Oct 2020 18:13:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 09CIDZWx004809 for ; Mon, 12 Oct 2020 14:13:35 -0400 Received: by smtp.corp.redhat.com (Postfix) id 01C231A92D; Mon, 12 Oct 2020 18:13:35 +0000 (UTC) Received: from antique-work.redhat.com (unknown [10.40.194.193]) by smtp.corp.redhat.com (Postfix) with ESMTP id 735ED19C78 for ; Mon, 12 Oct 2020 18:13:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602526428; 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=qgh0Zy+PMbau3BFl5SOMMRWiP0b7yfGqbC6v1ico80E=; b=WJW0XO3MjRs5gmkqdD682KnnZXtwaR93e9zMMy0xHP3wxKJzndoUnrXnWMibOmGiJhl8eE 0h8jAqF37zCn97mq1DdPmJf7p+IlzlMrZvWG+t0DLUyiapH8hUEWutbUrzjdnJ19Mzzzl+ Wkbyv1/hUmxYlrSfwxoBcKTsMC7dxzs= X-MC-Unique: BBsjRHDaMi-kxtGD7rPWsA-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 2/2] conf: virsecretobj: fix g_new0 allocation Date: Mon, 12 Oct 2020 20:13:29 +0200 Message-Id: <04519f703fdfc243ff50a4692c31e8ccd2191b04.1602526188.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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.84 on 10.5.11.22 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" Fixes commit which changed allocation from VIR_ALLOC_N to g_new0 but missed one +1 on number of allocated elements. Signed-off-by: Pavel Hrdina Reviewed-by: Laine Stump --- src/conf/virsecretobj.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/conf/virsecretobj.c b/src/conf/virsecretobj.c index c98d52f1e4..d74deb9316 100644 --- a/src/conf/virsecretobj.c +++ b/src/conf/virsecretobj.c @@ -588,7 +588,7 @@ virSecretObjListExport(virConnectPtr conn, =20 virObjectRWLockRead(secretobjs); if (secrets) - data.secrets =3D g_new0(virSecretPtr, virHashSize(secretobjs->objs= )); + data.secrets =3D g_new0(virSecretPtr, virHashSize(secretobjs->objs= ) + 1); =20 virHashForEach(secretobjs->objs, virSecretObjListExportCallback, &data= ); virObjectRWUnlock(secretobjs); --=20 2.26.2