Message ID | tencent_0D62BF818D106C96C26594CAC76BF3281306@qq.com |
---|---|
State | New |
Headers | show |
Series | [bpf-next] selftests/bpf: trace_helpers.c: Fix segfault | expand |
diff --git a/tools/testing/selftests/bpf/trace_helpers.c b/tools/testing/selftests/bpf/trace_helpers.c index 09a16a77bae4..a9d589c560d2 100644 --- a/tools/testing/selftests/bpf/trace_helpers.c +++ b/tools/testing/selftests/bpf/trace_helpers.c @@ -14,7 +14,7 @@ #define DEBUGFS "/sys/kernel/debug/tracing/" -#define MAX_SYMS 300000 +#define MAX_SYMS 400000 static struct ksym syms[MAX_SYMS]; static int sym_cnt; @@ -44,7 +44,8 @@ int load_kallsyms_refresh(void) continue; syms[i].addr = (long) addr; syms[i].name = strdup(func); - i++; + if (++i >= MAX_SYMS) + break; } fclose(f); sym_cnt = i;