From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5139E48A44 for ; Fri, 31 Oct 2025 15:40:15 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4978440150; Fri, 31 Oct 2025 15:40:15 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 81AE440150 for ; Fri, 31 Oct 2025 15:40:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761921613; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=z3xaKb8z3As3kHRzq2UlgkxVyFThifQSKg+yhcms+cU=; b=SYysn1YIapln1BB/HnXsAzuYq9Rz878YHNkitB6cxmWEaNZsfsFsHj/EgbuffOSaRNDnXs DnByrBWLbz6GSHfOI96URdelH2DZ8QcQEksR/nedJElNECkvFC41INRZexllDDDs5cXvxE JSnwoN6X/6FrDeBF7sAGV0mrJtW/TJY= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-167-OZETWNnZNf6X9hpcAHNK8g-1; Fri, 31 Oct 2025 10:40:09 -0400 X-MC-Unique: OZETWNnZNf6X9hpcAHNK8g-1 X-Mimecast-MFC-AGG-ID: OZETWNnZNf6X9hpcAHNK8g_1761921608 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8187B1955F1A; Fri, 31 Oct 2025 14:40:08 +0000 (UTC) Received: from rh.redhat.com (unknown [10.44.32.50]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 998DC180044F; Fri, 31 Oct 2025 14:40:06 +0000 (UTC) From: Kevin Traynor To: Stephen Hemminger Cc: Bruce Richardson , Chengwen Feng , dpdk stable Subject: patch 'test/argparse: change initialization to workaround LTO' has been queued to stable release 24.11.4 Date: Fri, 31 Oct 2025 14:34:10 +0000 Message-ID: <20251031143421.324432-128-ktraynor@redhat.com> In-Reply-To: <20251031143421.324432-1-ktraynor@redhat.com> References: <20251031143421.324432-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: Js8CYh_IwUksnE4yn8LsHgYmkBfwL_XbHwhATjfYTtQ_1761921608 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 24.11.4 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/05/25. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/6a73db92fbff3a64af61636b1b2557ef58c71319 Thanks. Kevin --- >From 6a73db92fbff3a64af61636b1b2557ef58c71319 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 9 Sep 2025 06:49:52 -0700 Subject: [PATCH] test/argparse: change initialization to workaround LTO MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [ upstream commit 3fc246e883c412f3c285bcabdb402b7d66e78526 ] When compiled with Link Time Optimization, the existing code generated an error, because the compiler was unable to intuit that there was space in the flexible array. In function ‘test_argparse_copy’, inlined from ‘test_argparse_init_obj’ at ../app/test/test_argparse.c:108:2, inlined from ‘test_argparse_opt_callback_parse_int_of_no_val’ at ../app/test/test_argparse.c:490:8: ../app/test/test_argparse.c:96:17: warning: ‘memcpy’ writing 56 bytes into a region of size 0 overflows the destination memcpy(&dst->args[i], &src->args[i], sizeof(src->args[i])); Initializing a structure with flexible array is special case and compiler expands the structure to fit. But inside the copy function it no longer knew that. The workaround is to put the copy inside the same function and use structure assignment. Also macro should be upper case. Fixes: 6c5c6571601c ("argparse: verify argument config") Signed-off-by: Stephen Hemminger Acked-by: Bruce Richardson Acked-by: Chengwen Feng --- app/test/test_argparse.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/app/test/test_argparse.c b/app/test/test_argparse.c index fcea620501..0ae54b2d64 100644 --- a/app/test/test_argparse.c +++ b/app/test/test_argparse.c @@ -72,5 +72,5 @@ test_argparse_callback(uint32_t index, const char *value, void *opaque) /* valid templater, must contain at least two args. */ -#define argparse_templater() { \ +#define ARGPARSE_TEMPLATE { \ .prog_name = "test_argparse", \ .usage = "-a xx -b yy", \ @@ -86,23 +86,22 @@ test_argparse_callback(uint32_t index, const char *value, void *opaque) } -static void -test_argparse_copy(struct rte_argparse *dst, struct rte_argparse *src) -{ - uint32_t i; - memcpy(dst, src, sizeof(*src)); - for (i = 0; /* NULL */; i++) { - memcpy(&dst->args[i], &src->args[i], sizeof(src->args[i])); - if (src->args[i].name_long == NULL) - break; - } -} static struct rte_argparse * test_argparse_init_obj(void) { - static struct rte_argparse backup = argparse_templater(); - static struct rte_argparse obj = argparse_templater(); - /* Because obj may be overwritten, do a deep copy. */ - test_argparse_copy(&obj, &backup); + /* Note: initialization of structure with flexible array + * increases the size of the variable to match. + */ + static const struct rte_argparse backup = ARGPARSE_TEMPLATE; + static struct rte_argparse obj = ARGPARSE_TEMPLATE; + unsigned int i; + + obj = backup; + for (i = 0; ; i++) { + obj.args[i] = backup.args[i]; + if (backup.args[i].name_long == NULL) + break; + } + return &obj; } -- 2.51.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2025-10-31 13:53:56.071408968 +0000 +++ 0128-test-argparse-change-initialization-to-workaround-LT.patch 2025-10-31 13:53:52.325524270 +0000 @@ -1 +1 @@ -From 3fc246e883c412f3c285bcabdb402b7d66e78526 Mon Sep 17 00:00:00 2001 +From 6a73db92fbff3a64af61636b1b2557ef58c71319 Mon Sep 17 00:00:00 2001 @@ -8,0 +9,2 @@ +[ upstream commit 3fc246e883c412f3c285bcabdb402b7d66e78526 ] + @@ -30 +31,0 @@ -Cc: stable@dpdk.org @@ -40 +41 @@ -index 71a85ea960..d3b95c4e35 100644 +index fcea620501..0ae54b2d64 100644 @@ -43 +44 @@ -@@ -73,5 +73,5 @@ test_argparse_callback(uint32_t index, const char *value, void *opaque) +@@ -72,5 +72,5 @@ test_argparse_callback(uint32_t index, const char *value, void *opaque) @@ -50 +51 @@ -@@ -89,23 +89,22 @@ test_argparse_callback(uint32_t index, const char *value, void *opaque) +@@ -86,23 +86,22 @@ test_argparse_callback(uint32_t index, const char *value, void *opaque)