From 46e9cacaaeb5414388fe4673a266efe3bc96ab44 Mon Sep 17 00:00:00 2001 From: Eelco Chaudron Date: Mon, 23 Oct 2023 16:22:32 +0200 Subject: [PATCH] ofp-table: Fix count_common_prefix_run() function. It appears that an issue existed in the count_common_prefix_run() function from the beginning. This problem came to light while addressing 'Dead assignment' warnings identified by the Clang static analyzer. Instead of updating the extra_prefix_len with the current (next) value, the next value was inadvertently updated with extra_prefix_len. This patch rectifies this behavior. Fixes: 95a5454c5110 ("ofp-print: Abbreviate lists of fields in table features output.") Signed-off-by: Eelco Chaudron Acked-by: Ilya Maximets Signed-off-by: Simon Horman --- lib/ofp-table.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ofp-table.c b/lib/ofp-table.c index a956754f2d5..f9bd3b7f9c8 100644 --- a/lib/ofp-table.c +++ b/lib/ofp-table.c @@ -1416,7 +1416,7 @@ count_common_prefix_run(const char *ids[], size_t n, if (!next) { break; } else if (next < extra_prefix_len) { - next = extra_prefix_len; + extra_prefix_len = next; } i++; }