]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
libbpf: Fix -Wdiscarded-qualifiers under C23
authorMikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
Sat, 6 Dec 2025 09:28:25 +0000 (14:28 +0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Feb 2026 15:57:45 +0000 (16:57 +0100)
commitab21cf885fb2af179c44d8beeabd716133b9385d
treef15941d458b6c3cc7a5f2208cb59c1bf0f257ed6
parentf749b366b8e7934058f807688aa936686da0d196
libbpf: Fix -Wdiscarded-qualifiers under C23

commit d70f79fef65810faf64dbae1f3a1b5623cdb2345 upstream.

glibc ≥ 2.42 (GCC 15) defaults to -std=gnu23, which promotes
-Wdiscarded-qualifiers to an error.

In C23, strstr() and strchr() return "const char *".

Change variable types to const char * where the pointers are never
modified (res, sym_sfx, next_path).

Suggested-by: Florian Weimer <fweimer@redhat.com>
Suggested-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
Link: https://lore.kernel.org/r/20251206092825.1471385-1-mikhail.v.gavrilov@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
[ shung-hsi.yu: needed to fix kernel build failure due to libbpf since glibc
  2.43+ (which adds 'const' qualifier to strstr) ]
Signed-off-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
tools/lib/bpf/libbpf.c