From nobody Sat Feb 7 08:13:52 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=1662639943; cv=none; d=zohomail.com; s=zohoarc; b=MFHs8kQa28cmAPkzVkTlhfLloug7UKIkxECDbGsI8hanJqlgHjtDbRymckStR1vZlLjpjZRim8gVyXk9BOxJnpB5r+YRQ0A1XBD4eyKn5Fx6AvkpaO5IfjlIGSR1XVsI1PH2g2EdMQoFGMEKXSBfBwfA7xbJuE94M8WcmGsptdM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1662639943; 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=k6jXgMvM3Yemb8PVJ5b+jUZLY5ELhDaLJrJhwU5nPnY=; b=bp8FZf71UA0UYum2n4oOwjs7QdgoybI39kNYyZZkuwRJAIxAt7tIZHFctOLNjjCtyHIA4VDN01bcsdZRflFPdnU87eg++jlPCvooYxIWeR2ygaS5x+S6ZJC63+Uh155MZPL4ikW5m0fmXvJiR6McW2Q7KgGiQ4OPLvPAMOgLLsU= 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 1662639943097181.00030660357606; Thu, 8 Sep 2022 05:25:43 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-81-3vXeBvNPPjeMmAvxwUCezQ-1; Thu, 08 Sep 2022 08:25:37 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6F2E6901852; Thu, 8 Sep 2022 12:25:10 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 55DB114152EC; Thu, 8 Sep 2022 12:25:10 +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 340D31946A53; Thu, 8 Sep 2022 12:25:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 99F031946A59 for ; Thu, 8 Sep 2022 12:25:09 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 7AAF72166B2B; Thu, 8 Sep 2022 12:25:09 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id ED51A2166B26 for ; Thu, 8 Sep 2022 12:25:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1662639942; 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=k6jXgMvM3Yemb8PVJ5b+jUZLY5ELhDaLJrJhwU5nPnY=; b=gMRIyJXb9Xn31vOjImTzEhj2yVvuxJ4h3Erz2VLMl0UimKqOjXgTpPE2z9hZ6XF1VAuC4m bT83YojUHmIxJmt8xsupxez8ikU3OxhV+7UdZAESNAxY9GyJTAr1LjsVYq+KF6Ce2zKwI/ ZhW+2ndpJBva6rGLBelubZYPP7AS+Nw= X-MC-Unique: 3vXeBvNPPjeMmAvxwUCezQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 3/5] util: netdev: Dynamically allocate 'struct nlattr' in virNetDevSwitchdevFeature Date: Thu, 8 Sep 2022 14:25:02 +0200 Message-Id: <4f0b64eaaa93df6b48d905ff2e9eef739e6b8e85.1662639767.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 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 2.85 on 10.11.54.7 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: 1662639944713100001 Content-Type: text/plain; charset="utf-8" At time of writing DEVLINK_ATTR_MAX equals to 176, thus the stack'd size of the pointer array is almost 1.4kiB. Allocate it dynamically. Signed-off-by: Peter Krempa --- src/util/virnetdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c index 6c6f6dee42..66cfc5d781 100644 --- a/src/util/virnetdev.c +++ b/src/util/virnetdev.c @@ -3210,7 +3210,7 @@ virNetDevSwitchdevFeature(const char *ifname, struct nl_msg *nl_msg =3D NULL; g_autofree struct nlmsghdr *resp =3D NULL; unsigned int recvbuflen; - struct nlattr *tb[DEVLINK_ATTR_MAX + 1] =3D {NULL, }; + g_autofree struct nlattr **tb =3D g_new0(struct nlattr *, DEVLINK_ATTR= _MAX + 1); g_autoptr(virPCIDevice) pci_device_ptr =3D NULL; struct genlmsghdr gmsgh =3D { .cmd =3D DEVLINK_CMD_ESWITCH_GET, --=20 2.37.1