From nobody Mon Nov 25 22:28:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1594156509; cv=none; d=zohomail.com; s=zohoarc; b=cxkzjhgwZZbUesAIFIvNrS9owXVWN/iDutVEcSYaW9bvmrkelCIRl5o+B7EK+W8ik9GzkmqEjagOgZZI0ME0yXsju6zESiwM42FCpXLCOe73PYALPCyOyUI+5Ak9/se8hFeoGUqNIBkH/x8MPk2K89Jsi/nfT4q+GWCYKk5fkFg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594156509; 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=VoiVqym9ZryzJ0VI9blXwKAdYfddgD6y5vMFK/JKXUo=; b=lXl5bjT0bGnf2iWXyxRm2Az4kQskPC0TD2eIy8Sce57vf4tAB2QbOGLTA1Ac1N7orzTfQqA2tEQYNRNWMrScmU6nukZsSFXJKeDLPzBksrZhtg3J8YO14OmjPxGw2h7jzv6JKcxuaIyTFIv6yUJeYpk/ljVaz5OH6vvv6aGrrYk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1594156509072787.4341861414757; Tue, 7 Jul 2020 14:15:09 -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-381--ZKSNuqYP1u7deCYWVHhJg-1; Tue, 07 Jul 2020 17:15:05 -0400 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 BAACF107ACF4; Tue, 7 Jul 2020 21:14:59 +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 997231A7D8; Tue, 7 Jul 2020 21:14:59 +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 69C3172F76; Tue, 7 Jul 2020 21:14:59 +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 067L8TCB008027 for ; Tue, 7 Jul 2020 17:08:29 -0400 Received: by smtp.corp.redhat.com (Postfix) id 67224797E0; Tue, 7 Jul 2020 21:08:29 +0000 (UTC) Received: from vhost2.laine.org (ovpn-112-194.phx2.redhat.com [10.3.112.194]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1FC8D79220 for ; Tue, 7 Jul 2020 21:08:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594156507; 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=VoiVqym9ZryzJ0VI9blXwKAdYfddgD6y5vMFK/JKXUo=; b=RriEFMek3KXAC7qvkVYuvRvCh9c8JDL4PF3BsapzrvWP40pKtBgF/MAr0X9DgyYa2/PuuC b/G60yhlCIfrdk83X3ZARoLtf9iydEgMC0VrK8UxWOc5xSlDp4BgShgNsne+xF3uI4dwO8 G8zvrm47brAMkUSLWAKak9x5GVgP8h0= X-MC-Unique: -ZKSNuqYP1u7deCYWVHhJg-1 From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH v2 13/15] nwfilter: replace VIR_ALLOC with g_new0 Date: Tue, 7 Jul 2020 17:08:13 -0400 Message-Id: <20200707210815.1797463-14-laine@redhat.com> In-Reply-To: <20200707210815.1797463-1-laine@redhat.com> References: <20200707210815.1797463-1-laine@redhat.com> 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.84 on 10.5.11.23 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" Signed-off-by: Laine Stump Reviewed-by: J=C3=A1n Tomko --- src/nwfilter/nwfilter_dhcpsnoop.c | 9 +++------ src/nwfilter/nwfilter_driver.c | 3 +-- src/nwfilter/nwfilter_ebiptables_driver.c | 3 +-- src/nwfilter/nwfilter_gentech_driver.c | 3 +-- src/nwfilter/nwfilter_learnipaddr.c | 6 ++---- 5 files changed, 8 insertions(+), 16 deletions(-) diff --git a/src/nwfilter/nwfilter_dhcpsnoop.c b/src/nwfilter/nwfilter_dhcp= snoop.c index 6de41ff209..4bc1607694 100644 --- a/src/nwfilter/nwfilter_dhcpsnoop.c +++ b/src/nwfilter/nwfilter_dhcpsnoop.c @@ -562,8 +562,7 @@ virNWFilterSnoopReqNew(const char *ifkey) return NULL; } =20 - if (VIR_ALLOC(req) < 0) - return NULL; + req =3D g_new0(virNWFilterSnoopReq, 1); =20 req->threadStatus =3D THREAD_STATUS_NONE; =20 @@ -737,8 +736,7 @@ virNWFilterSnoopReqLeaseAdd(virNWFilterSnoopReqPtr req, =20 virNWFilterSnoopReqUnlock(req); =20 - if (VIR_ALLOC(pl) < 0) - return -1; + pl =3D g_new0(virNWFilterSnoopIPLease, 1); *pl =3D *plnew; =20 /* protect req->threadkey */ @@ -1160,8 +1158,7 @@ virNWFilterSnoopDHCPDecodeJobSubmit(virThreadPoolPtr = pool, if (len <=3D MIN_VALID_DHCP_PKT_SIZE || len > sizeof(job->packet)) return 0; =20 - if (VIR_ALLOC(job) < 0) - return -1; + job =3D g_new0(virNWFilterDHCPDecodeJob, 1); =20 memcpy(job->packet, pep, len); job->caplen =3D len; diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c index 1c407727db..39d0a2128e 100644 --- a/src/nwfilter/nwfilter_driver.c +++ b/src/nwfilter/nwfilter_driver.c @@ -193,8 +193,7 @@ nwfilterStateInitialize(bool privileged, !(sysbus =3D virDBusGetSystemBus())) return VIR_DRV_STATE_INIT_ERROR; =20 - if (VIR_ALLOC(driver) < 0) - return VIR_DRV_STATE_INIT_ERROR; + driver =3D g_new0(virNWFilterDriverState, 1); =20 driver->lockFD =3D -1; if (virMutexInit(&driver->lock) < 0) diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c b/src/nwfilter/nwfil= ter_ebiptables_driver.c index 8ac3a7271e..177e7e62b9 100644 --- a/src/nwfilter/nwfilter_ebiptables_driver.c +++ b/src/nwfilter/nwfilter_ebiptables_driver.c @@ -3312,8 +3312,7 @@ ebtablesGetSubChainInsts(virHashTablePtr chains, if ((int)idx < 0) continue; =20 - if (VIR_ALLOC(inst) < 0) - goto cleanup; + inst =3D g_new0(ebtablesSubChainInst, 1); inst->priority =3D *(const virNWFilterChainPriority *)filter_names= [i].value; inst->incoming =3D incoming; inst->protoidx =3D idx; diff --git a/src/nwfilter/nwfilter_gentech_driver.c b/src/nwfilter/nwfilter= _gentech_driver.c index 400d064724..acd5614987 100644 --- a/src/nwfilter/nwfilter_gentech_driver.c +++ b/src/nwfilter/nwfilter_gentech_driver.c @@ -262,8 +262,7 @@ virNWFilterRuleDefToRuleInst(virNWFilterDefPtr def, virNWFilterRuleInstPtr ruleinst; int ret =3D -1; =20 - if (VIR_ALLOC(ruleinst) < 0) - goto cleanup; + ruleinst =3D g_new0(virNWFilterRuleInst, 1); =20 ruleinst->chainSuffix =3D def->chainsuffix; ruleinst->chainPriority =3D def->chainPriority; diff --git a/src/nwfilter/nwfilter_learnipaddr.c b/src/nwfilter/nwfilter_le= arnipaddr.c index 95e21050b4..63fac37132 100644 --- a/src/nwfilter/nwfilter_learnipaddr.c +++ b/src/nwfilter/nwfilter_learnipaddr.c @@ -151,8 +151,7 @@ virNWFilterLockIface(const char *ifname) =20 ifaceLock =3D virHashLookup(ifaceLockMap, ifname); if (!ifaceLock) { - if (VIR_ALLOC(ifaceLock) < 0) - goto error; + ifaceLock =3D g_new0(virNWFilterIfaceLock, 1); =20 if (virMutexInitRecursive(&ifaceLock->lock) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", @@ -718,8 +717,7 @@ virNWFilterLearnIPAddress(virNWFilterTechDriverPtr tech= driver, return -1; } =20 - if (VIR_ALLOC(req) < 0) - return -1; + req =3D g_new0(virNWFilterIPAddrLearnReq, 1); =20 if (!(req->binding =3D virNWFilterBindingDefCopy(binding))) goto err_free_req; --=20 2.25.4