[PATCH] app/testpmd: fix random flow item token

Gregory Etelson getelson at nvidia.com
Mon May 19 08:30:45 CEST 2025


ITEM_RANDOM_VALUE token initializes 32 bits mask argument value from
a constant source buffer.

Testpmd initiated the mast value from the 3 bytes buffer -
[0xff, 0xff, 0x00].
When testpmd copied that value to 32 bits mask it accessed a memory
byte outside the source buffer.

The patch fixes the source buffer size.

Fixes: 738ef8f7c706 ("ethdev: add flow item for random matching")

Cc: stable at dpdk.org
Signed-off-by: Gregory Etelson <getelson at nvidia.com>
---
 app/test-pmd/cmdline_flow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 998527590f..fc807ad8cf 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -5591,7 +5591,7 @@ static const struct token token_list[] = {
 		.next = NEXT(item_random, NEXT_ENTRY(COMMON_UNSIGNED),
 			     item_param),
 		.args = ARGS(ARGS_ENTRY_MASK(struct rte_flow_item_random,
-					     value, "\xff\xff")),
+					     value, "\x00\x00\xff\xff")),
 	},
 	[ITEM_GRE_KEY] = {
 		.name = "gre_key",
-- 
2.48.1



More information about the dev mailing list