* [PATCH] selftests/bpf: fix const qualifier in fexit_bpf2bpf test
@ 2026-04-09 9:11 Woojin Ji
2026-04-09 10:20 ` Jiayuan Chen
0 siblings, 1 reply; 3+ messages in thread
From: Woojin Ji @ 2026-04-09 9:11 UTC (permalink / raw)
To: bpf, linux-kselftest; +Cc: linux-kernel, ast, daniel, andrii, shuah, Woojin Ji
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 <random6.xyz@gmail.com>
---
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] selftests/bpf: fix const qualifier in fexit_bpf2bpf test
2026-04-09 9:11 [PATCH] selftests/bpf: fix const qualifier in fexit_bpf2bpf test Woojin Ji
@ 2026-04-09 10:20 ` Jiayuan Chen
2026-04-09 14:40 ` Woojin Ji
0 siblings, 1 reply; 3+ messages in thread
From: Jiayuan Chen @ 2026-04-09 10:20 UTC (permalink / raw)
To: Woojin Ji, bpf, linux-kselftest; +Cc: linux-kernel, ast, daniel, andrii, shuah
On 4/9/26 5:11 PM, Woojin Ji wrote:
> 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 <random6.xyz@gmail.com>
> ---
> 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], "/");
Already exist.
https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/tools/testing/selftests/bpf/prog_tests/fexit_bpf2bpf.c?id=ca0f39a369c5f927c3d004e63a5a778b08a9df94
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] selftests/bpf: fix const qualifier in fexit_bpf2bpf test
2026-04-09 10:20 ` Jiayuan Chen
@ 2026-04-09 14:40 ` Woojin Ji
0 siblings, 0 replies; 3+ messages in thread
From: Woojin Ji @ 2026-04-09 14:40 UTC (permalink / raw)
To: bpf; +Cc: linux-kselftest, linux-kernel, ast, daniel, andrii, shuah
Thanks for the pointer.
I missed that commit ca0f39a369c5 was already applied to bpf-next.
Sorry for sending a duplicate patch.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-04-09 14:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-09 9:11 [PATCH] selftests/bpf: fix const qualifier in fexit_bpf2bpf test Woojin Ji
2026-04-09 10:20 ` Jiayuan Chen
2026-04-09 14:40 ` Woojin Ji
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox