From patchwork Thu Apr 4 17:15:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 139103 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4D1D043DFB; Thu, 4 Apr 2024 19:15:23 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 39D234067B; Thu, 4 Apr 2024 19:15:18 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id F1FE1402CC for ; Thu, 4 Apr 2024 19:15:14 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 55D8D20E97BD; Thu, 4 Apr 2024 10:15:14 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 55D8D20E97BD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1712250914; bh=aAA7sFcoLU0TA8wNQPECKqZN3neiLmIQ/dd15t0zKNI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S72f5Dw/ksO1qcsNMRnIPLVsa/9MFCdr70ha2t4U4dzjFNd9MGWfmeUZfH/51Gk2A SGYMXYEjdoJf1NCOY0ODooKMADYlq3tZ00GguZofzwlTnj++0YbvD7CY+TyoUS6NoS IE1YB5kkcfaYfWoJvc8b6nJU4ZvxCqqfn1d5ICXw= From: Tyler Retzlaff To: dev@dpdk.org Cc: Bruce Richardson , Stephen Hemminger , Thomas Monjalon , =?utf-8?q?Morten_Br=C3=B8rup?= , Tyler Retzlaff Subject: [PATCH 2/4] hash: use alloca instead of vla trivial Date: Thu, 4 Apr 2024 10:15:11 -0700 Message-Id: <1712250913-1977-3-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1712250913-1977-1-git-send-email-roretzla@linux.microsoft.com> References: <20231107193220.GA15232@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> <1712250913-1977-1-git-send-email-roretzla@linux.microsoft.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org RFC sample illustrating simple conversion of VLA to alloca() where dimension multiplier removed. Signed-off-by: Tyler Retzlaff --- lib/hash/rte_thash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/hash/rte_thash.c b/lib/hash/rte_thash.c index 68f653f..633e211 100644 --- a/lib/hash/rte_thash.c +++ b/lib/hash/rte_thash.c @@ -771,7 +771,7 @@ struct rte_thash_subtuple_helper * uint32_t desired_value, unsigned int attempts, rte_thash_check_tuple_t fn, void *userdata) { - uint32_t tmp_tuple[tuple_len / sizeof(uint32_t)]; + uint32_t *tmp_tuple = alloca(tuple_len); unsigned int i, j, ret = 0; uint32_t hash, adj_bits; const uint8_t *hash_key;