Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Shreenidhi Shedi <yesshedi@gmail.com>
To: gregkh@linuxfoundation.org, acme@kernel.org, linux@treblig.org,
	mikhail.v.gavrilov@gmail.com
Cc: yesshedi@gmail.com, stable@vger.kernel.org,
	Florian Weimer <fweimer@redhat.com>,
	Andrii Nakryiko <andrii@kernel.org>,
	Alexei Starovoitov <ast@kernel.org>
Subject: [PATCH 6.1.y v2 01/18] libbpf: Fix -Wdiscarded-qualifiers under C23
Date: Mon, 11 May 2026 12:40:34 +0530	[thread overview]
Message-ID: <20260511071051.537859-2-yesshedi@gmail.com> (raw)
In-Reply-To: <20260511071051.537859-1-yesshedi@gmail.com>

From: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>

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>
Signed-off-by: Shreenidhi Shedi <yesshedi@gmail.com>
---
 tools/lib/bpf/libbpf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 7bd6aff6e260..33b214a91338 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -10748,7 +10748,7 @@ static int resolve_full_path(const char *file, char *result, size_t result_sz)
 		if (!search_paths[i])
 			continue;
 		for (s = search_paths[i]; s != NULL; s = strchr(s, ':')) {
-			char *next_path;
+			const char *next_path;
 			int seg_len;
 
 			if (s[0] == ':')
-- 
2.54.0


  reply	other threads:[~2026-05-11  7:36 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-11  7:10 [PATCH 6.1.y v2 00/18] Backport fixes for -Wdiscarded-qualifiers and -Wnonnull with newer glibc Shreenidhi Shedi
2026-05-11  7:10 ` Shreenidhi Shedi [this message]
2026-05-11  7:10 ` [PATCH 6.1.y v2 02/18] perf diff: Constify strchr() return variables Shreenidhi Shedi
2026-05-11  7:10 ` [PATCH 6.1.y v2 03/18] perf test bpf: Address error about non-null argument for epoll_pwait 2nd arg Shreenidhi Shedi
2026-05-11  7:10 ` [PATCH 6.1.y v2 04/18] perf list: Fix -Wdiscarded-qualifiers under C23 Shreenidhi Shedi
2026-05-11  7:10 ` [PATCH 6.1.y v2 05/18] perf trace: Deal with compiler const checks Shreenidhi Shedi
2026-05-11  7:10 ` [PATCH 6.1.y v2 06/18] perf tools: Use const for variables receiving str{str,r?chr}() returns Shreenidhi Shedi
2026-05-11  7:10 ` [PATCH 6.1.y v2 07/18] perf parse-events: Fix -Wdiscarded-qualifiers under C23 Shreenidhi Shedi
2026-05-11  7:10 ` [PATCH 6.1.y v2 08/18] perf tools: Remove unused color_fwrite_lines Shreenidhi Shedi
2026-05-11  7:10 ` [PATCH 6.1.y v2 09/18] perf strlist: Don't write to const memory Shreenidhi Shedi
2026-05-11  7:10 ` [PATCH 6.1.y v2 10/18] perf metricgroup: Constify variables storing the result of strchr() on const tables Shreenidhi Shedi
2026-05-11  7:10 ` [PATCH 6.1.y v2 11/18] perf session: Don't write to memory pointed to a const pointer Shreenidhi Shedi
2026-05-11  7:10 ` [PATCH 6.1.y v2 12/18] perf trace-event: Constify variables storing the result of strchr() on const tables Shreenidhi Shedi
2026-05-11  7:10 ` [PATCH 6.1.y v2 13/18] perf units: " Shreenidhi Shedi
2026-05-11  7:10 ` [PATCH 6.1.y v2 14/18] perf bpf: Fix -Wdiscarded-qualifiers under C23 Shreenidhi Shedi
2026-05-11  7:10 ` [PATCH 6.1.y v2 15/18] perf time-utils: Constify variables storing the result of strchr() on const tables Shreenidhi Shedi
2026-05-11  7:10 ` [PATCH 6.1.y v2 16/18] perf demangle-java: " Shreenidhi Shedi
2026-05-11  7:10 ` [PATCH 6.1.y v2 17/18] perf parse-events:: Fix -Wdiscarded-qualifiers under C23 Shreenidhi Shedi
2026-05-11  7:10 ` [PATCH 6.1.y v2 18/18] perf bpf-event: Constify variables storing the result of strchr() on const tables Shreenidhi Shedi
2026-05-11  8:16 ` [PATCH 6.1.y v2 00/18] Backport fixes for -Wdiscarded-qualifiers and -Wnonnull with newer glibc Greg KH
2026-05-13  6:37   ` Shreenidhi Shedi
2026-05-13  7:21     ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260511071051.537859-2-yesshedi@gmail.com \
    --to=yesshedi@gmail.com \
    --cc=acme@kernel.org \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=fweimer@redhat.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux@treblig.org \
    --cc=mikhail.v.gavrilov@gmail.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox