[PATCH 07/16] btf_encoder: Fix types__match parameter comparison in BTF_KIND_FUNC_PROTO
Arnaldo Carvalho de Melo <[email protected]> Mon, 22 Jun 2026 17:24:30 -0300
| Newsgroups | org.kernel.vger.dwarves |
|---|---|
| Message-ID | <[email protected]> |
From: Arnaldo Carvalho de Melo <[email protected]> The BTF_KIND_FUNC_PROTO loop in types__match() compared t1->type vs t2->type (the return types) on every iteration instead of the individual parameter types p1->type vs p2->type. This meant all function prototypes with the same return type and parameter count were considered matching regardless of their actual parameter types, causing gcc to warn that p1 and p2 were unused: btf_encoder.c: In function 'types__match': btf_encoder.c:1123:49: warning: variable 'p2' set but not used btf_encoder.c:1122:49: warning: variable 'p1' set but not used Fix the loop to compare each parameter type pair individually. Reported-by: Sashiko:gemini-3-1-pro-preview # Running on a local machine Assisted-by: Claude:claude-opus-4-6 Signed-off-by: Arnaldo Carvalho de Melo <[email protected]> --- btf_encoder.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/btf_encoder.c b/btf_encoder.c index 243064695f6cf171..82dd5f27138c2949 100644 --- a/btf_encoder.c +++ b/btf_encoder.c @@ -1129,8 +1129,8 @@ static bool types__match(struct btf_encoder *encoder, btf2, t2->type)) return false; for (i = 0; i < vlen; i++, p1++, p2++) { - if (!types__match(encoder, btf1, t1->type, - btf2, t2->type)) + if (!types__match(encoder, btf1, p1->type, + btf2, p2->type)) return false; } return true; -- 2.54.0