From nobody Sun Feb 8 23:06:08 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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 170.10.129.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=1693396786; cv=none; d=zohomail.com; s=zohoarc; b=HAOMHy44zXr9KwEVBJCT9vXo4R543DdBn+uahYincqTqgl4aWEhYkd9qyK6j5HarxtxQbiBkKQ/Zd9XfkH39Z4K7R9FWrY40QhW7i2dn05oeSheJuH64VnyqGT0AVD8hjDnuHQgaNbyPh/PYZ/4pWC6etzE87tHIGnKFNG5/GBc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693396786; 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=M/3ZKqM5ErMobw3fSBXw1ZATzkEeT45zb+Uaon0x6fc=; b=h2kUoftLRtyqPpIuhw/4J3GXIeHN+9KewixD8kwgBkoR/ogpCMWXx4BgJQslYAsmsP1Q5Q+k6i9rYZPXxXXm5ouA2P5Uk+od24UveBqRydnsYsaIs+4aMdpSPicWjl8BeakREoevUwYzlxNNn9P8QuU8Wxmzz3wqMSeJX1mY9pM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1693396786932141.61317165325124; Wed, 30 Aug 2023 04:59:46 -0700 (PDT) Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-317-KZFM06sDMYOwxUIwR5RxFg-1; Wed, 30 Aug 2023 07:59:42 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 415391C06ED0; Wed, 30 Aug 2023 11:59:40 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2F4FC40C6F4C; Wed, 30 Aug 2023 11:59:40 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id D3E5A1946A4B; Wed, 30 Aug 2023 11:59:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 6AEA51946589 for ; Wed, 30 Aug 2023 11:59:26 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 4FD07C15BC0; Wed, 30 Aug 2023 11:59:26 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id C4B0DC15BAE for ; Wed, 30 Aug 2023 11:59:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693396785; 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=M/3ZKqM5ErMobw3fSBXw1ZATzkEeT45zb+Uaon0x6fc=; b=BLbzvnaHySZ3GTFOu0pT51zx0wQO2M453FNQNC+I9PB6OlMFmuYG5K526edHgFKd6pTFD7 86tG/DQzjP0GRurLGWPztUEbWiQdLsE0Ky81WhsragEfg/Qdk8r+f0NKhooRL4GY7ILRx2 zulhzlXOJH+vyZi6swQdmBIR/079VhY= X-MC-Unique: KZFM06sDMYOwxUIwR5RxFg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 3/8] virHostValidateBhyve: Heap allocate massive 'struct kld_file_stat' Date: Wed, 30 Aug 2023 13:59:17 +0200 Message-ID: <8f8646767b3bc19a023a1bdc1ae9d69e7fcae37a.1693396633.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693396788607100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: Kristina Hanicova --- tools/virt-host-validate-bhyve.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/virt-host-validate-bhyve.c b/tools/virt-host-validate-bh= yve.c index 9457fac9a5..db1cdd8e2c 100644 --- a/tools/virt-host-validate-bhyve.c +++ b/tools/virt-host-validate-bhyve.c @@ -49,24 +49,24 @@ int virHostValidateBhyve(void) { int ret =3D 0; int fileid =3D 0; - struct kld_file_stat stat; + g_autofree struct kld_file_stat *stat =3D g_new0(struct kld_file_stat,= 1); bool vmm_loaded =3D false; bool if_tap_loaded =3D false; bool if_bridge_loaded =3D false; bool nmdm_loaded =3D false; for (fileid =3D kldnext(0); fileid > 0; fileid =3D kldnext(fileid)) { - stat.version =3D sizeof(struct kld_file_stat); - if (kldstat(fileid, &stat) < 0) + stat->version =3D sizeof(struct kld_file_stat); + if (kldstat(fileid, stat) < 0) continue; - if (STREQ(stat.name, "vmm.ko")) + if (STREQ(stat->name, "vmm.ko")) vmm_loaded =3D true; - else if (STREQ(stat.name, "if_tap.ko")) + else if (STREQ(stat->name, "if_tap.ko")) if_tap_loaded =3D true; - else if (STREQ(stat.name, "if_bridge.ko")) + else if (STREQ(stat->name, "if_bridge.ko")) if_bridge_loaded =3D true; - else if (STREQ(stat.name, "nmdm.ko")) + else if (STREQ(stat->name, "nmdm.ko")) nmdm_loaded =3D true; } --=20 2.41.0