prog_name is an array of const char * strings, so strstr() returns a pointer into const data.
Store the result in a const char * to avoid discarding the const qualifier. With GCC 15 this triggers -Werror=discarded-qualifiers and breaks the build of tools/testing/selftests/bpf. Signed-off-by: Woojin Ji <[email protected]> --- tools/testing/selftests/bpf/prog_tests/fexit_bpf2bpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/prog_tests/fexit_bpf2bpf.c b/tools/testing/selftests/bpf/prog_tests/fexit_bpf2bpf.c index f29fc789c14b..d8225da4c1af 100644 --- a/tools/testing/selftests/bpf/prog_tests/fexit_bpf2bpf.c +++ b/tools/testing/selftests/bpf/prog_tests/fexit_bpf2bpf.c @@ -111,7 +111,7 @@ static void test_fexit_bpf2bpf_common(const char *obj_file, struct bpf_link_info link_info; struct bpf_program *pos; const char *pos_sec_name; - char *tgt_name; + const char *tgt_name; __s32 btf_id; tgt_name = strstr(prog_name[i], "/"); -- 2.53.0

