[PATCH v11 4/6] test: fix format overflow warning in ACL test

Stephen Hemminger
2026-01-17T02:38:51Z

This test has an array of input lines, but the two dimensional
array confuses compiler length checks. Convert to an array
of pointers to fixed strings which avoids the problem.
Make both variables static since not shared with other code.

Fixes: 5205954791cb ("app/test: packet framework unit tests")
Cc: stable@dpdk.org

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
app/test/test_table_acl.c | 30 ++++++++++++++----------------
1 file changed, 14 insertions(+), 16 deletions(-)

diff --git a/app/test/test_table_acl.c b/app/test/test_table_acl.c
index dff9bddfb9..7b6ea16cfd 100644
--- a/app/test/test_table_acl.c
+++ b/app/test/test_table_acl.c
@@ -312,22 +312,6 @@ parse_cb_ipv4_rule_del(char *str, struct rte_table_acl_rule_delete_params *v)
return 0;
}

-/*
- * The format for these rules DO NOT need the port ranges to be
- * separated by ' : ', just ':'. It's a lot more readable and
- * cleaner, IMO.
- */
-char lines[][128] = {
- "@0.0.0.0/0 0.0.0.0/0 0:65535 0:65535 2/0xff", /* Protocol check */
- "@192.168.3.1/32 0.0.0.0/0 0:65535 0:65535 0/0", /* Src IP checl */
- "@0.0.0.0/0 10.4.4.1/32 0:65535 0:65535 0/0", /* dst IP check */
- "@0.0.0.0/0 0.0.0.0/0 105:105 0:65535 0/0", /* src port check */
- "@0.0.0.0/0 0.0.0.0/0 0:65535 206:206 0/0", /* dst port check */
-};
-
-char line[128];
-
-
static int
setup_acl_pipeline(void)
{
@@ -343,6 +327,20 @@ setup_acl_pipeline(void)
parse_5tuple parser;
char acl_name[64];

+ /*
+ * The format for these rules DO NOT need the port ranges to be
+ * separated by ' : ', just ':'. It's a lot more readable and
+ * cleaner, IMO.
+ */
+ static const char * const lines[] = {
+ "@0.0.0.0/0 0.0.0.0/0 0:65535 0:65535 2/0xff", /* Protocol check */
+ "@192.168.3.1/32 0.0.0.0/0 0:65535 0:65535 0/0", /* Src IP checl */
+ "@0.0.0.0/0 10.4.4.1/32 0:65535 0:65535 0/0", /* dst IP check */
+ "@0.0.0.0/0 0.0.0.0/0 105:105 0:65535 0/0", /* src port check */
+ "@0.0.0.0/0 0.0.0.0/0 0:65535 206:206 0/0", /* dst port check */
+ };
+ char line[LINE_MAX];
+
/* Pipeline configuration */
p = rte_pipeline_create(&pipeline_params);
if (p == NULL) {
--
2.51.0