Files
linux-stable-mirror/tools/perf/util/btf.c
T
Mark BrownandArnaldo Carvalho de Melo 3287a1881c perf bpf: Fix up build failure due to change of btf_vlen() return type
Fix:

util/btf.c: In function '__btf_type__find_member_by_name':
util/btf.c:19:43: error: comparison of integer expressions of different signedness: 'int' and '__u32' {aka 'unsigned int'} [-Werror=sign-compare]
   19 |         for (i = 0, m = btf_members(t); i < btf_vlen(t); i++, m++) {
      |                                           ^

builtin-trace.c: In function 'syscall_arg__strtoul_btf_enum':
builtin-trace.c:967:27: error: comparison of integer expressions of different signedness: 'int' and '__u32' {aka 'unsigned int'} [-Werror=sign-compare]
  967 |         for (int i = 0; i < btf_vlen(bt); ++i, ++be) {
      |                           ^

by making the variable the same type as the function.

Committer note:

Add an extra hunk from Alan Maguire, fixing btf_enum_scnprintf().

Reviewed-by: Alan Maguire <alan.maguire@oracle.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2026-06-22 15:53:34 -03:00

28 lines
632 B
C

// SPDX-License-Identifier: GPL-2.0
/*
* Arnaldo Carvalho de Melo <acme@redhat.com>
*
* Copyright (C) 2024, Red Hat, Inc
*/
#include <bpf/btf.h>
#include <util/btf.h>
#include <string.h>
const struct btf_member *__btf_type__find_member_by_name(struct btf *btf,
int type_id, const char *member_name)
{
const struct btf_type *t = btf__type_by_id(btf, type_id);
const struct btf_member *m;
u32 i;
for (i = 0, m = btf_members(t); i < btf_vlen(t); i++, m++) {
const char *current_member_name = btf__name_by_offset(btf, m->name_off);
if (!strcmp(current_member_name, member_name))
return m;
}
return NULL;
}