* [PATCH v1 00/18] Backport fixes for -Wdiscarded-qualifiers and -Wnonnull with newer glibc
@ 2026-05-09 17:35 Shreenidhi Shedi
2026-05-09 17:35 ` [PATCH v1 01/18] libbpf: Fix -Wdiscarded-qualifiers under C23 Shreenidhi Shedi
` (18 more replies)
0 siblings, 19 replies; 20+ messages in thread
From: Shreenidhi Shedi @ 2026-05-09 17:35 UTC (permalink / raw)
To: gregkh, acme, linux, mikhail.v.gavrilov; +Cc: yesshedi, linux-kernel
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Hi all,
This patch series backports a number of patches from master to 6.1.y
to fix `-Wdiscarded-qualifiers` and `-Wnonnull` build issues with
newer glibc versions.
Arnaldo Carvalho de Melo (12):
perf diff: Constify strchr() return variables
perf test bpf: Address error about non-null argument for epoll_pwait
2nd arg
perf trace: Deal with compiler const checks
perf tools: Use const for variables receiving str{str,r?chr}() returns
perf strlist: Don't write to const memory
perf metricgroup: Constify variables storing the result of strchr() on
const tables
perf session: Don't write to memory pointed to a const pointer
perf trace-event: Constify variables storing the result of strchr() on
const tables
perf units: Constify variables storing the result of strchr() on const
tables
perf time-utils: Constify variables storing the result of strchr() on
const tables
perf demangle-java: Constify variables storing the result of strchr()
on const tables
perf bpf-event: Constify variables storing the result of strchr() on
const tables
Dr. David Alan Gilbert (1):
perf tools: Remove unused color_fwrite_lines
Mikhail Gavrilov (1):
libbpf: Fix -Wdiscarded-qualifiers under C23
Shreenidhi Shedi (4):
perf list: Fix -Wdiscarded-qualifiers under C23
perf parse-events: Fix -Wdiscarded-qualifiers under C23
perf bpf: Fix -Wdiscarded-qualifiers under C23
perf parse-events:: Fix -Wdiscarded-qualifiers under C23
tools/lib/bpf/libbpf.c | 2 +-
tools/perf/builtin-diff.c | 12 +++++-------
tools/perf/builtin-list.c | 3 ++-
tools/perf/builtin-trace.c | 2 +-
tools/perf/jvmti/libjvmti.c | 2 +-
tools/perf/tests/bpf.c | 3 ++-
tools/perf/util/bpf-event.c | 3 ++-
tools/perf/util/bpf-loader.c | 2 +-
tools/perf/util/color.c | 28 ----------------------------
tools/perf/util/color.h | 1 -
tools/perf/util/demangle-java.c | 2 +-
tools/perf/util/evlist.c | 3 ++-
tools/perf/util/metricgroup.c | 3 +--
tools/perf/util/parse-events.c | 2 +-
tools/perf/util/print-events.c | 4 ++--
tools/perf/util/session.c | 6 +++---
tools/perf/util/strlist.c | 12 ++++++++----
tools/perf/util/time-utils.c | 4 ++--
tools/perf/util/trace-event-info.c | 2 +-
tools/perf/util/units.c | 2 +-
20 files changed, 37 insertions(+), 61 deletions(-)
--
2.54.0
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH v1 01/18] libbpf: Fix -Wdiscarded-qualifiers under C23
2026-05-09 17:35 [PATCH v1 00/18] Backport fixes for -Wdiscarded-qualifiers and -Wnonnull with newer glibc Shreenidhi Shedi
@ 2026-05-09 17:35 ` Shreenidhi Shedi
2026-05-09 17:35 ` [PATCH v1 02/18] perf diff: Constify strchr() return variables Shreenidhi Shedi
` (17 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Shreenidhi Shedi @ 2026-05-09 17:35 UTC (permalink / raw)
To: gregkh, acme, linux, mikhail.v.gavrilov
Cc: yesshedi, linux-kernel, Florian Weimer, Andrii Nakryiko,
Alexei Starovoitov
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
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v1 02/18] perf diff: Constify strchr() return variables
2026-05-09 17:35 [PATCH v1 00/18] Backport fixes for -Wdiscarded-qualifiers and -Wnonnull with newer glibc Shreenidhi Shedi
2026-05-09 17:35 ` [PATCH v1 01/18] libbpf: Fix -Wdiscarded-qualifiers under C23 Shreenidhi Shedi
@ 2026-05-09 17:35 ` Shreenidhi Shedi
2026-05-09 17:35 ` [PATCH v1 03/18] perf test bpf: Address error about non-null argument for epoll_pwait 2nd arg Shreenidhi Shedi
` (16 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Shreenidhi Shedi @ 2026-05-09 17:35 UTC (permalink / raw)
To: gregkh, acme, linux, mikhail.v.gavrilov
Cc: yesshedi, linux-kernel, Ian Rogers, Arnaldo Carvalho de Melo
From: Arnaldo Carvalho de Melo <acme@kernel.org>
commit f6f41aef53761517391b6192fe5b4bc30b2d717a upstream
Newer glibc versions return const char for strchr() when the 's' arg is
const, change the return variable to const to match that.
Also we don't need to turn that ',' into a '\0', as strtol() will stop
in the first invalid char. No need to touch read only memory.
First noticed with fedora 44.
Reviewed-by: Ian Rogers <irogers@google.com>
Link: https://lore.kernel.org/r/20251211221756.96294-3-acme@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Shreenidhi Shedi <yesshedi@gmail.com>
---
tools/perf/builtin-diff.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index ed07cc6cca56..9a05d67f541b 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -177,10 +177,9 @@ static struct header_column {
}
};
-static int setup_compute_opt_wdiff(char *opt)
+static int setup_compute_opt_wdiff(const char *opt)
{
- char *w1_str = opt;
- char *w2_str;
+ const char *w1_str = opt, *w2_str;
int ret = -EINVAL;
@@ -191,8 +190,7 @@ static int setup_compute_opt_wdiff(char *opt)
if (!w2_str)
goto out;
- *w2_str++ = 0x0;
- if (!*w2_str)
+ if (!*++w2_str)
goto out;
compute_wdiff_w1 = strtol(w1_str, NULL, 10);
@@ -213,7 +211,7 @@ static int setup_compute_opt_wdiff(char *opt)
return ret;
}
-static int setup_compute_opt(char *opt)
+static int setup_compute_opt(const char *opt)
{
if (compute == COMPUTE_WEIGHTED_DIFF)
return setup_compute_opt_wdiff(opt);
@@ -233,7 +231,7 @@ static int setup_compute(const struct option *opt, const char *str,
char *cstr = (char *) str;
char buf[50];
unsigned i;
- char *option;
+ const char *option;
if (!str) {
*cp = COMPUTE_DELTA;
--
2.54.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v1 03/18] perf test bpf: Address error about non-null argument for epoll_pwait 2nd arg
2026-05-09 17:35 [PATCH v1 00/18] Backport fixes for -Wdiscarded-qualifiers and -Wnonnull with newer glibc Shreenidhi Shedi
2026-05-09 17:35 ` [PATCH v1 01/18] libbpf: Fix -Wdiscarded-qualifiers under C23 Shreenidhi Shedi
2026-05-09 17:35 ` [PATCH v1 02/18] perf diff: Constify strchr() return variables Shreenidhi Shedi
@ 2026-05-09 17:35 ` Shreenidhi Shedi
2026-05-09 17:35 ` [PATCH v1 04/18] perf list: Fix -Wdiscarded-qualifiers under C23 Shreenidhi Shedi
` (15 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Shreenidhi Shedi @ 2026-05-09 17:35 UTC (permalink / raw)
To: gregkh, acme, linux, mikhail.v.gavrilov
Cc: yesshedi, linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
Ian Rogers, Jiri Olsa, Namhyung Kim
From: Arnaldo Carvalho de Melo <acme@redhat.com>
commit ed847e30f001b207013b6136c264454d7560557f upstream
First noticed on Fedora Rawhide:
tests/bpf.c: In function ‘epoll_pwait_loop’:
tests/bpf.c:36:17: error: argument 2 null where non-null expected [-Werror=nonnull]
36 | epoll_pwait(-(i + 1), NULL, 0, 0, NULL);
| ^~~~~~~~~~~
In file included from tests/bpf.c:5:
/usr/include/sys/epoll.h:134:12: note: in a call to function ‘epoll_pwait’ declared ‘nonnull’
134 | extern int epoll_pwait (int __epfd, struct epoll_event *__events,
| ^~~~~~~~~~~
[perfbuilder@27cfe44d67ed perf-6.5.0-rc2]$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/13/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,m2,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --enable-libstdcxx-backtrace --with-libstdcxx-zoneinfo=/usr/share/zoneinfo --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl=/builddir/build/BUILD/gcc-13.2.1-20230728/obj-x86_64-redhat-linux/isl-install --enable-offload-targets=nvptx-none --without-cuda-driver --enable-offload-defaulted --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux --with-build-config=bootstrap-lto --enable-link-serialization=1
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.2.1 20230728 (Red Hat 13.2.1-1) (GCC)
[perfbuilder@27cfe44d67ed perf-6.5.0-rc2]$
Just add that argument to address this compiler warning.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/lkml/ZMj8+bvN86D0ZKiB@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Shreenidhi Shedi <yesshedi@gmail.com>
---
tools/perf/tests/bpf.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/perf/tests/bpf.c b/tools/perf/tests/bpf.c
index 6a4235a9cf57..d5bf0e47a48a 100644
--- a/tools/perf/tests/bpf.c
+++ b/tools/perf/tests/bpf.c
@@ -29,11 +29,12 @@
static int epoll_pwait_loop(void)
{
+ struct epoll_event events;
int i;
/* Should fail NR_ITERS times */
for (i = 0; i < NR_ITERS; i++)
- epoll_pwait(-(i + 1), NULL, 0, 0, NULL);
+ epoll_pwait(-(i + 1), &events, 0, 0, NULL);
return 0;
}
--
2.54.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v1 04/18] perf list: Fix -Wdiscarded-qualifiers under C23
2026-05-09 17:35 [PATCH v1 00/18] Backport fixes for -Wdiscarded-qualifiers and -Wnonnull with newer glibc Shreenidhi Shedi
` (2 preceding siblings ...)
2026-05-09 17:35 ` [PATCH v1 03/18] perf test bpf: Address error about non-null argument for epoll_pwait 2nd arg Shreenidhi Shedi
@ 2026-05-09 17:35 ` Shreenidhi Shedi
2026-05-09 17:35 ` [PATCH v1 05/18] perf trace: Deal with compiler const checks Shreenidhi Shedi
` (14 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Shreenidhi Shedi @ 2026-05-09 17:35 UTC (permalink / raw)
To: gregkh, acme, linux, mikhail.v.gavrilov; +Cc: yesshedi, linux-kernel
builtin-list.c:104:31: warning: assignment discards 'const' qualifier
from pointer target type [-Wdiscarded-qualifiers]
104 | else if ((sep = strchr(argv[i], ':')) != NULL) {
glibc >= 2.42 defaults to -std=gnu23, which promotes
-Wdiscarded-qualifiers to an error.
Signed-off-by: Shreenidhi Shedi <yesshedi@gmail.com>
---
tools/perf/builtin-list.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/perf/builtin-list.c b/tools/perf/builtin-list.c
index 58e1ec1654ef..a37f3b8a597c 100644
--- a/tools/perf/builtin-list.c
+++ b/tools/perf/builtin-list.c
@@ -75,7 +75,8 @@ int cmd_list(int argc, const char **argv)
}
for (i = 0; i < argc; ++i) {
- char *sep, *s;
+ const char *sep;
+ char *s;
if (strcmp(argv[i], "tracepoint") == 0)
print_tracepoint_events(NULL, NULL, raw_dump);
--
2.54.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v1 05/18] perf trace: Deal with compiler const checks
2026-05-09 17:35 [PATCH v1 00/18] Backport fixes for -Wdiscarded-qualifiers and -Wnonnull with newer glibc Shreenidhi Shedi
` (3 preceding siblings ...)
2026-05-09 17:35 ` [PATCH v1 04/18] perf list: Fix -Wdiscarded-qualifiers under C23 Shreenidhi Shedi
@ 2026-05-09 17:35 ` Shreenidhi Shedi
2026-05-09 17:35 ` [PATCH v1 06/18] perf tools: Use const for variables receiving str{str,r?chr}() returns Shreenidhi Shedi
` (13 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Shreenidhi Shedi @ 2026-05-09 17:35 UTC (permalink / raw)
To: gregkh, acme, linux, mikhail.v.gavrilov
Cc: yesshedi, linux-kernel, Arnaldo Carvalho de Melo, Ian Rogers
From: Arnaldo Carvalho de Melo <acme@redhat.com>
commit 2c850606a46b319d5128bda59f67b1fc642d94ef upstream
The strchr() function these days return const/non-const based on the arg
it receives, and sometimes we need to use casts when we're dealing with
variables that are used in code that needs to safely change the returned
value and sometimes not (as it points to really const areas).
Tweak one such case.
Reviewed-by: Ian Rogers <irogers@google.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Shreenidhi Shedi <yesshedi@gmail.com>
---
tools/perf/builtin-trace.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 441655e659c2..313eb0929324 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -4622,7 +4622,7 @@ static int trace__parse_events_option(const struct option *opt, const char *str,
}
while (1) {
- if ((sep = strchr(s, ',')) != NULL)
+ if ((sep = strchr((char *)s, ',')) != NULL)
*sep = '\0';
list = 0;
--
2.54.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v1 06/18] perf tools: Use const for variables receiving str{str,r?chr}() returns
2026-05-09 17:35 [PATCH v1 00/18] Backport fixes for -Wdiscarded-qualifiers and -Wnonnull with newer glibc Shreenidhi Shedi
` (4 preceding siblings ...)
2026-05-09 17:35 ` [PATCH v1 05/18] perf trace: Deal with compiler const checks Shreenidhi Shedi
@ 2026-05-09 17:35 ` Shreenidhi Shedi
2026-05-09 17:35 ` [PATCH v1 07/18] perf parse-events: Fix -Wdiscarded-qualifiers under C23 Shreenidhi Shedi
` (12 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Shreenidhi Shedi @ 2026-05-09 17:35 UTC (permalink / raw)
To: gregkh, acme, linux, mikhail.v.gavrilov
Cc: yesshedi, linux-kernel, Ian Rogers, Arnaldo Carvalho de Melo
From: Arnaldo Carvalho de Melo <acme@kernel.org>
commit 45718bce7daf39c618188b70a52644bb5a2f968a upstream
Newer glibc versions return const char for str{str,chr}() where the
haystack/s is const so to avoid warnings like these on fedora 44 change
some variables to const:
36 8.17 fedora:44 : FAIL gcc version 15.2.1 20251111 (Red Hat 15.2.1-4) (GCC)
libbpf.c: In function 'kallsyms_cb':
libbpf.c:8489:13: error: assignment discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
8489 | res = strstr(sym_name, ".llvm.");
Reviewed-by: Ian Rogers <irogers@google.com>
Link: https://lore.kernel.org/r/20251211221756.96294-4-acme@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Shreenidhi Shedi <yesshedi@gmail.com>
---
tools/perf/jvmti/libjvmti.c | 2 +-
tools/perf/util/evlist.c | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/tools/perf/jvmti/libjvmti.c b/tools/perf/jvmti/libjvmti.c
index fcca275e5bf9..d6b04d0fd35a 100644
--- a/tools/perf/jvmti/libjvmti.c
+++ b/tools/perf/jvmti/libjvmti.c
@@ -142,7 +142,7 @@ copy_class_filename(const char * class_sign, const char * file_name, char * resu
*/
if (*class_sign == 'L') {
int j, i = 0;
- char *p = strrchr(class_sign, '/');
+ const char *p = strrchr(class_sign, '/');
if (p) {
/* drop the 'L' prefix and copy up to the final '/' */
for (i = 0; i < (p - class_sign); i++)
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 41bbe6f85b0d..391a694ae2af 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -1885,7 +1885,8 @@ static int evlist__parse_control_fifo(const char *str, int *ctl_fd, int *ctl_fd_
int evlist__parse_control(const char *str, int *ctl_fd, int *ctl_fd_ack, bool *ctl_fd_close)
{
- char *comma = NULL, *endptr = NULL;
+ const char *comma = NULL;
+ char *endptr = NULL;
*ctl_fd_close = false;
--
2.54.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v1 07/18] perf parse-events: Fix -Wdiscarded-qualifiers under C23
2026-05-09 17:35 [PATCH v1 00/18] Backport fixes for -Wdiscarded-qualifiers and -Wnonnull with newer glibc Shreenidhi Shedi
` (5 preceding siblings ...)
2026-05-09 17:35 ` [PATCH v1 06/18] perf tools: Use const for variables receiving str{str,r?chr}() returns Shreenidhi Shedi
@ 2026-05-09 17:35 ` Shreenidhi Shedi
2026-05-09 17:35 ` [PATCH v1 08/18] perf tools: Remove unused color_fwrite_lines Shreenidhi Shedi
` (11 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Shreenidhi Shedi @ 2026-05-09 17:35 UTC (permalink / raw)
To: gregkh, acme, linux, mikhail.v.gavrilov; +Cc: yesshedi, linux-kernel
glibc >= 2.42 defaults to -std=gnu23, which promotes
-Wdiscarded-qualifiers to an error.
util/print-events.c:206:21: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
206 | buf = strchr(nd->s, '@');
util/print-events.c:215:29: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
215 | ptr = strchr(nd2->s, '@');
Signed-off-by: Shreenidhi Shedi <yesshedi@gmail.com>
---
tools/perf/util/print-events.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/print-events.c b/tools/perf/util/print-events.c
index c4d5d87fae2f..1ef1a3ed8051 100644
--- a/tools/perf/util/print-events.c
+++ b/tools/perf/util/print-events.c
@@ -203,7 +203,7 @@ void print_sdt_events(const char *subsys_glob, const char *event_glob,
strlist__delete(bidlist);
strlist__for_each_entry(nd, sdtlist) {
- buf = strchr(nd->s, '@');
+ buf = strchr((char *)nd->s, '@');
if (buf)
*(buf++) = '\0';
if (name_only) {
@@ -212,7 +212,7 @@ void print_sdt_events(const char *subsys_glob, const char *event_glob,
}
nd2 = strlist__next(nd);
if (nd2) {
- ptr = strchr(nd2->s, '@');
+ ptr = strchr((char *)nd2->s, '@');
if (ptr)
*ptr = '\0';
if (strcmp(nd->s, nd2->s) == 0)
--
2.54.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v1 08/18] perf tools: Remove unused color_fwrite_lines
2026-05-09 17:35 [PATCH v1 00/18] Backport fixes for -Wdiscarded-qualifiers and -Wnonnull with newer glibc Shreenidhi Shedi
` (6 preceding siblings ...)
2026-05-09 17:35 ` [PATCH v1 07/18] perf parse-events: Fix -Wdiscarded-qualifiers under C23 Shreenidhi Shedi
@ 2026-05-09 17:35 ` Shreenidhi Shedi
2026-05-09 17:35 ` [PATCH v1 09/18] perf strlist: Don't write to const memory Shreenidhi Shedi
` (10 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Shreenidhi Shedi @ 2026-05-09 17:35 UTC (permalink / raw)
To: gregkh, acme, linux, mikhail.v.gavrilov
Cc: yesshedi, linux-kernel, Ian Rogers, Namhyung Kim
From: "Dr. David Alan Gilbert" <linux@treblig.org>
commit c7c1bb78f3eec716bc35f58d74592331cc3281b2 upstream
color_fwrite_lines() was added by 2009's commit
8fc0321f1ad0 ("perf_counter tools: Add color terminal output support")
but has never been used.
Remove it.
Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Reviewed-by: Ian Rogers <irogers@google.com>
Link: https://lore.kernel.org/r/20241009003938.254936-1-linux@treblig.org
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Shreenidhi Shedi <yesshedi@gmail.com>
---
tools/perf/util/color.c | 28 ----------------------------
tools/perf/util/color.h | 1 -
2 files changed, 29 deletions(-)
diff --git a/tools/perf/util/color.c b/tools/perf/util/color.c
index bffbdd216a6a..e51f0a676a22 100644
--- a/tools/perf/util/color.c
+++ b/tools/perf/util/color.c
@@ -93,34 +93,6 @@ int color_fprintf(FILE *fp, const char *color, const char *fmt, ...)
return r;
}
-/*
- * This function splits the buffer by newlines and colors the lines individually.
- *
- * Returns 0 on success.
- */
-int color_fwrite_lines(FILE *fp, const char *color,
- size_t count, const char *buf)
-{
- if (!*color)
- return fwrite(buf, count, 1, fp) != 1;
-
- while (count) {
- char *p = memchr(buf, '\n', count);
-
- if (p != buf && (fputs(color, fp) < 0 ||
- fwrite(buf, p ? (size_t)(p - buf) : count, 1, fp) != 1 ||
- fputs(PERF_COLOR_RESET, fp) < 0))
- return -1;
- if (!p)
- return 0;
- if (fputc('\n', fp) < 0)
- return -1;
- count -= p + 1 - buf;
- buf = p + 1;
- }
- return 0;
-}
-
const char *get_percent_color(double percent)
{
const char *color = PERF_COLOR_NORMAL;
diff --git a/tools/perf/util/color.h b/tools/perf/util/color.h
index 01f7bed21c9b..aecf56dae73f 100644
--- a/tools/perf/util/color.h
+++ b/tools/perf/util/color.h
@@ -39,7 +39,6 @@ int color_vsnprintf(char *bf, size_t size, const char *color,
int color_vfprintf(FILE *fp, const char *color, const char *fmt, va_list args);
int color_fprintf(FILE *fp, const char *color, const char *fmt, ...);
int color_snprintf(char *bf, size_t size, const char *color, const char *fmt, ...);
-int color_fwrite_lines(FILE *fp, const char *color, size_t count, const char *buf);
int value_color_snprintf(char *bf, size_t size, const char *fmt, double value);
int percent_color_snprintf(char *bf, size_t size, const char *fmt, ...);
int percent_color_len_snprintf(char *bf, size_t size, const char *fmt, ...);
--
2.54.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v1 09/18] perf strlist: Don't write to const memory
2026-05-09 17:35 [PATCH v1 00/18] Backport fixes for -Wdiscarded-qualifiers and -Wnonnull with newer glibc Shreenidhi Shedi
` (7 preceding siblings ...)
2026-05-09 17:35 ` [PATCH v1 08/18] perf tools: Remove unused color_fwrite_lines Shreenidhi Shedi
@ 2026-05-09 17:35 ` Shreenidhi Shedi
2026-05-09 17:35 ` [PATCH v1 10/18] perf metricgroup: Constify variables storing the result of strchr() on const tables Shreenidhi Shedi
` (9 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Shreenidhi Shedi @ 2026-05-09 17:35 UTC (permalink / raw)
To: gregkh, acme, linux, mikhail.v.gavrilov
Cc: yesshedi, linux-kernel, Arnaldo Carvalho de Melo
From: Arnaldo Carvalho de Melo <acme@redhat.com>
commit 678ed6b707e4b2db250f255d2f959322896dae65 upstream
Do a strdup to the list string and parse from it, free at the end.
This is to deal with newer glibcs const-correctness.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Shreenidhi Shedi <yesshedi@gmail.com>
---
tools/perf/util/strlist.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/tools/perf/util/strlist.c b/tools/perf/util/strlist.c
index 8a868cbeffae..98883672fcf4 100644
--- a/tools/perf/util/strlist.c
+++ b/tools/perf/util/strlist.c
@@ -139,21 +139,25 @@ static int strlist__parse_list_entry(struct strlist *slist, const char *s,
return err;
}
-static int strlist__parse_list(struct strlist *slist, const char *s, const char *subst_dir)
+static int strlist__parse_list(struct strlist *slist, const char *list, const char *subst_dir)
{
- char *sep;
+ char *sep, *s = strdup(list), *sdup = s;
int err;
+ if (s == NULL)
+ return -ENOMEM;
+
while ((sep = strchr(s, ',')) != NULL) {
*sep = '\0';
err = strlist__parse_list_entry(slist, s, subst_dir);
- *sep = ',';
if (err != 0)
return err;
s = sep + 1;
}
- return *s ? strlist__parse_list_entry(slist, s, subst_dir) : 0;
+ err = *s ? strlist__parse_list_entry(slist, s, subst_dir) : 0;
+ free(sdup);
+ return err;
}
struct strlist *strlist__new(const char *list, const struct strlist_config *config)
--
2.54.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v1 10/18] perf metricgroup: Constify variables storing the result of strchr() on const tables
2026-05-09 17:35 [PATCH v1 00/18] Backport fixes for -Wdiscarded-qualifiers and -Wnonnull with newer glibc Shreenidhi Shedi
` (8 preceding siblings ...)
2026-05-09 17:35 ` [PATCH v1 09/18] perf strlist: Don't write to const memory Shreenidhi Shedi
@ 2026-05-09 17:35 ` Shreenidhi Shedi
2026-05-09 17:35 ` [PATCH v1 11/18] perf session: Don't write to memory pointed to a const pointer Shreenidhi Shedi
` (8 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Shreenidhi Shedi @ 2026-05-09 17:35 UTC (permalink / raw)
To: gregkh, acme, linux, mikhail.v.gavrilov
Cc: yesshedi, linux-kernel, Arnaldo Carvalho de Melo
From: Arnaldo Carvalho de Melo <acme@redhat.com>
commit b42868624c7d00206f77d19a6fbfea73a44ff6f2 upstream
As newer glibcs will propagate the const attribute of the searched table
to its return.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Shreenidhi Shedi <yesshedi@gmail.com>
---
tools/perf/util/metricgroup.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c
index 4c98ac29ee13..664045fa0c8e 100644
--- a/tools/perf/util/metricgroup.c
+++ b/tools/perf/util/metricgroup.c
@@ -644,11 +644,10 @@ static const char *code_characters = ",-=@";
static int encode_metric_id(struct strbuf *sb, const char *x)
{
- char *c;
int ret = 0;
for (; *x; x++) {
- c = strchr(code_characters, *x);
+ const char *c = strchr(code_characters, *x);
if (c) {
ret = strbuf_addch(sb, '!');
if (ret)
--
2.54.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v1 11/18] perf session: Don't write to memory pointed to a const pointer
2026-05-09 17:35 [PATCH v1 00/18] Backport fixes for -Wdiscarded-qualifiers and -Wnonnull with newer glibc Shreenidhi Shedi
` (9 preceding siblings ...)
2026-05-09 17:35 ` [PATCH v1 10/18] perf metricgroup: Constify variables storing the result of strchr() on const tables Shreenidhi Shedi
@ 2026-05-09 17:35 ` Shreenidhi Shedi
2026-05-09 17:35 ` [PATCH v1 12/18] perf trace-event: Constify variables storing the result of strchr() on const tables Shreenidhi Shedi
` (7 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Shreenidhi Shedi @ 2026-05-09 17:35 UTC (permalink / raw)
To: gregkh, acme, linux, mikhail.v.gavrilov
Cc: yesshedi, linux-kernel, Arnaldo Carvalho de Melo
From: Arnaldo Carvalho de Melo <acme@redhat.com>
commit f1321cce848c558fde4c0c6bcd5e53f3cefd3af2 upstream
Since it is freshly allocated just attribute it to a non-const pointer
and then change it via that pointer.
That way we avoid const-correctness warnings in recent glibc versions.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Shreenidhi Shedi <yesshedi@gmail.com>
---
tools/perf/util/session.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 1c4d124b1053..9d11cf2aab0c 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -2641,7 +2641,7 @@ bool perf_session__has_traces(struct perf_session *session, const char *msg)
int map__set_kallsyms_ref_reloc_sym(struct map *map, const char *symbol_name, u64 addr)
{
- char *bracket;
+ char *bracket, *name;
struct ref_reloc_sym *ref;
struct kmap *kmap;
@@ -2649,13 +2649,13 @@ int map__set_kallsyms_ref_reloc_sym(struct map *map, const char *symbol_name, u6
if (ref == NULL)
return -ENOMEM;
- ref->name = strdup(symbol_name);
+ ref->name = name = strdup(symbol_name);
if (ref->name == NULL) {
free(ref);
return -ENOMEM;
}
- bracket = strchr(ref->name, ']');
+ bracket = strchr(name, ']');
if (bracket)
*bracket = '\0';
--
2.54.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v1 12/18] perf trace-event: Constify variables storing the result of strchr() on const tables
2026-05-09 17:35 [PATCH v1 00/18] Backport fixes for -Wdiscarded-qualifiers and -Wnonnull with newer glibc Shreenidhi Shedi
` (10 preceding siblings ...)
2026-05-09 17:35 ` [PATCH v1 11/18] perf session: Don't write to memory pointed to a const pointer Shreenidhi Shedi
@ 2026-05-09 17:35 ` Shreenidhi Shedi
2026-05-09 17:35 ` [PATCH v1 13/18] perf units: " Shreenidhi Shedi
` (6 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Shreenidhi Shedi @ 2026-05-09 17:35 UTC (permalink / raw)
To: gregkh, acme, linux, mikhail.v.gavrilov
Cc: yesshedi, linux-kernel, Arnaldo Carvalho de Melo
From: Arnaldo Carvalho de Melo <acme@redhat.com>
commit 97b81df7225830c4db3c17ed1235d2f3eb613d3d uptream
As newer glibcs will propagate the const attribute of the searched table
to its return.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Shreenidhi Shedi <yesshedi@gmail.com>
---
tools/perf/util/trace-event-info.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/trace-event-info.c b/tools/perf/util/trace-event-info.c
index 892c323b4ac9..5a6dec2dc0d8 100644
--- a/tools/perf/util/trace-event-info.c
+++ b/tools/perf/util/trace-event-info.c
@@ -477,7 +477,7 @@ static struct tracepoint_path *tracepoint_id_to_path(u64 config)
static struct tracepoint_path *tracepoint_name_to_path(const char *name)
{
struct tracepoint_path *path = zalloc(sizeof(*path));
- char *str = strchr(name, ':');
+ const char *str = strchr(name, ':');
if (path == NULL || str == NULL) {
free(path);
--
2.54.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v1 13/18] perf units: Constify variables storing the result of strchr() on const tables
2026-05-09 17:35 [PATCH v1 00/18] Backport fixes for -Wdiscarded-qualifiers and -Wnonnull with newer glibc Shreenidhi Shedi
` (11 preceding siblings ...)
2026-05-09 17:35 ` [PATCH v1 12/18] perf trace-event: Constify variables storing the result of strchr() on const tables Shreenidhi Shedi
@ 2026-05-09 17:35 ` Shreenidhi Shedi
2026-05-09 17:35 ` [PATCH v1 14/18] perf bpf: Fix -Wdiscarded-qualifiers under C23 Shreenidhi Shedi
` (5 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Shreenidhi Shedi @ 2026-05-09 17:35 UTC (permalink / raw)
To: gregkh, acme, linux, mikhail.v.gavrilov
Cc: yesshedi, linux-kernel, Arnaldo Carvalho de Melo
From: Arnaldo Carvalho de Melo <acme@redhat.com>
commit 0e14cb3b24f8f301cf6490a4493afc98321ed5bb upstream
As newer glibcs will propagate the const attribute of the searched table
to its return.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Shreenidhi Shedi <yesshedi@gmail.com>
---
tools/perf/util/units.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/units.c b/tools/perf/util/units.c
index 4c6a86e1cb54..0bbacf5a29aa 100644
--- a/tools/perf/util/units.c
+++ b/tools/perf/util/units.c
@@ -12,7 +12,7 @@ unsigned long parse_tag_value(const char *str, struct parse_tag *tags)
struct parse_tag *i = tags;
while (i->tag) {
- char *s = strchr(str, i->tag);
+ const char *s = strchr(str, i->tag);
if (s) {
unsigned long int value;
--
2.54.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v1 14/18] perf bpf: Fix -Wdiscarded-qualifiers under C23
2026-05-09 17:35 [PATCH v1 00/18] Backport fixes for -Wdiscarded-qualifiers and -Wnonnull with newer glibc Shreenidhi Shedi
` (12 preceding siblings ...)
2026-05-09 17:35 ` [PATCH v1 13/18] perf units: " Shreenidhi Shedi
@ 2026-05-09 17:35 ` Shreenidhi Shedi
2026-05-09 17:35 ` [PATCH v1 15/18] perf time-utils: Constify variables storing the result of strchr() on const tables Shreenidhi Shedi
` (4 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Shreenidhi Shedi @ 2026-05-09 17:35 UTC (permalink / raw)
To: gregkh, acme, linux, mikhail.v.gavrilov; +Cc: yesshedi, linux-kernel
glibc >= 2.42 defaults to -std=gnu23, which promotes
-Wdiscarded-qualifiers to an error.
util/bpf-loader.c: In function 'config_bpf_program':
util/bpf-loader.c:588:27: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] 588 | char *s = strchr(main_str, ':');
Signed-off-by: Shreenidhi Shedi <yesshedi@gmail.com>
---
tools/perf/util/bpf-loader.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/bpf-loader.c b/tools/perf/util/bpf-loader.c
index f4adeccdbbcb..7f4e774a3435 100644
--- a/tools/perf/util/bpf-loader.c
+++ b/tools/perf/util/bpf-loader.c
@@ -585,7 +585,7 @@ config_bpf_program(struct bpf_program *prog)
goto errout;
if (is_tp) {
- char *s = strchr(main_str, ':');
+ const char *s = strchr(main_str, ':');
priv->is_tp = true;
priv->sys_name = strndup(main_str, s - main_str);
--
2.54.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v1 15/18] perf time-utils: Constify variables storing the result of strchr() on const tables
2026-05-09 17:35 [PATCH v1 00/18] Backport fixes for -Wdiscarded-qualifiers and -Wnonnull with newer glibc Shreenidhi Shedi
` (13 preceding siblings ...)
2026-05-09 17:35 ` [PATCH v1 14/18] perf bpf: Fix -Wdiscarded-qualifiers under C23 Shreenidhi Shedi
@ 2026-05-09 17:35 ` Shreenidhi Shedi
2026-05-09 17:35 ` [PATCH v1 16/18] perf demangle-java: " Shreenidhi Shedi
` (3 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Shreenidhi Shedi @ 2026-05-09 17:35 UTC (permalink / raw)
To: gregkh, acme, linux, mikhail.v.gavrilov
Cc: yesshedi, linux-kernel, Arnaldo Carvalho de Melo
From: Arnaldo Carvalho de Melo <acme@redhat.com>
commit 21c0bc9144834e39762dd6fddbb255ebb80cf079 upstream
As newer glibcs will propagate the const attribute of the searched table
to its return.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Shreenidhi Shedi <yesshedi@gmail.com>
---
tools/perf/util/time-utils.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/time-utils.c b/tools/perf/util/time-utils.c
index 1b91ccd4d523..d43c4577d7eb 100644
--- a/tools/perf/util/time-utils.c
+++ b/tools/perf/util/time-utils.c
@@ -325,7 +325,7 @@ static int percent_comma_split(struct perf_time_interval *ptime_buf, int num,
}
static int one_percent_convert(struct perf_time_interval *ptime_buf,
- const char *ostr, u64 start, u64 end, char *c)
+ const char *ostr, u64 start, u64 end, const char *c)
{
char *str;
int len = strlen(ostr), ret;
@@ -358,7 +358,7 @@ static int one_percent_convert(struct perf_time_interval *ptime_buf,
int perf_time__percent_parse_str(struct perf_time_interval *ptime_buf, int num,
const char *ostr, u64 start, u64 end)
{
- char *c;
+ const char *c;
/*
* ostr example:
--
2.54.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v1 16/18] perf demangle-java: Constify variables storing the result of strchr() on const tables
2026-05-09 17:35 [PATCH v1 00/18] Backport fixes for -Wdiscarded-qualifiers and -Wnonnull with newer glibc Shreenidhi Shedi
` (14 preceding siblings ...)
2026-05-09 17:35 ` [PATCH v1 15/18] perf time-utils: Constify variables storing the result of strchr() on const tables Shreenidhi Shedi
@ 2026-05-09 17:35 ` Shreenidhi Shedi
2026-05-09 17:35 ` [PATCH v1 17/18] perf parse-events:: Fix -Wdiscarded-qualifiers under C23 Shreenidhi Shedi
` (2 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Shreenidhi Shedi @ 2026-05-09 17:35 UTC (permalink / raw)
To: gregkh, acme, linux, mikhail.v.gavrilov
Cc: yesshedi, linux-kernel, Arnaldo Carvalho de Melo
From: Arnaldo Carvalho de Melo <acme@redhat.com>
commit 79bba3a1834e7ba6c437674582cc9f3ae6fb638c upstream
As newer glibcs will propagate the const attribute of the searched table
to its return.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Shreenidhi Shedi <yesshedi@gmail.com>
---
tools/perf/util/demangle-java.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/demangle-java.c b/tools/perf/util/demangle-java.c
index ddf33d58bcd3..c3cb327ed562 100644
--- a/tools/perf/util/demangle-java.c
+++ b/tools/perf/util/demangle-java.c
@@ -158,7 +158,7 @@ char *
java_demangle_sym(const char *str, int flags)
{
char *buf, *ptr;
- char *p;
+ const char *p;
size_t len, l1 = 0;
if (!str)
--
2.54.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v1 17/18] perf parse-events:: Fix -Wdiscarded-qualifiers under C23
2026-05-09 17:35 [PATCH v1 00/18] Backport fixes for -Wdiscarded-qualifiers and -Wnonnull with newer glibc Shreenidhi Shedi
` (15 preceding siblings ...)
2026-05-09 17:35 ` [PATCH v1 16/18] perf demangle-java: " Shreenidhi Shedi
@ 2026-05-09 17:35 ` Shreenidhi Shedi
2026-05-09 17:35 ` [PATCH v1 18/18] perf bpf-event: Constify variables storing the result of strchr() on const tables Shreenidhi Shedi
2026-05-10 16:25 ` [PATCH v1 00/18] Backport fixes for -Wdiscarded-qualifiers and -Wnonnull with newer glibc Greg KH
18 siblings, 0 replies; 20+ messages in thread
From: Shreenidhi Shedi @ 2026-05-09 17:35 UTC (permalink / raw)
To: gregkh, acme, linux, mikhail.v.gavrilov; +Cc: yesshedi, linux-kernel
glibc >= 2.42 defaults to -std=gnu23, which promotes
-Wdiscarded-qualifiers to an error.
Signed-off-by: Shreenidhi Shedi <yesshedi@gmail.com>
---
tools/perf/util/parse-events.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 5973f46c2375..e3b7950331bc 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -1647,7 +1647,7 @@ int parse_events__modifier_group(struct list_head *list,
*/
static bool is_same_uncore_block(const char *pmu_name_a, const char *pmu_name_b)
{
- char *end_a, *end_b;
+ const char *end_a, *end_b;
end_a = strrchr(pmu_name_a, '_');
end_b = strrchr(pmu_name_b, '_');
--
2.54.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v1 18/18] perf bpf-event: Constify variables storing the result of strchr() on const tables
2026-05-09 17:35 [PATCH v1 00/18] Backport fixes for -Wdiscarded-qualifiers and -Wnonnull with newer glibc Shreenidhi Shedi
` (16 preceding siblings ...)
2026-05-09 17:35 ` [PATCH v1 17/18] perf parse-events:: Fix -Wdiscarded-qualifiers under C23 Shreenidhi Shedi
@ 2026-05-09 17:35 ` Shreenidhi Shedi
2026-05-10 16:25 ` [PATCH v1 00/18] Backport fixes for -Wdiscarded-qualifiers and -Wnonnull with newer glibc Greg KH
18 siblings, 0 replies; 20+ messages in thread
From: Shreenidhi Shedi @ 2026-05-09 17:35 UTC (permalink / raw)
To: gregkh, acme, linux, mikhail.v.gavrilov
Cc: yesshedi, linux-kernel, Arnaldo Carvalho de Melo
From: Arnaldo Carvalho de Melo <acme@redhat.com>
commit 8bf093acb3f1f07d846c86e32308f9f9954ed579 upstream
As newer glibcs will propagate the const attribute of the searched table
to its return.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Shreenidhi Shedi <yesshedi@gmail.com>
---
tools/perf/util/bpf-event.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/bpf-event.c b/tools/perf/util/bpf-event.c
index 91c7bfa82a50..fbaab3d3a476 100644
--- a/tools/perf/util/bpf-event.c
+++ b/tools/perf/util/bpf-event.c
@@ -411,7 +411,8 @@ kallsyms_process_symbol(void *data, const char *_name,
char type __maybe_unused, u64 start)
{
char disp[KSYM_NAME_LEN];
- char *module, *name;
+ const char *module;
+ char *name;
unsigned long id;
int err = 0;
--
2.54.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH v1 00/18] Backport fixes for -Wdiscarded-qualifiers and -Wnonnull with newer glibc
2026-05-09 17:35 [PATCH v1 00/18] Backport fixes for -Wdiscarded-qualifiers and -Wnonnull with newer glibc Shreenidhi Shedi
` (17 preceding siblings ...)
2026-05-09 17:35 ` [PATCH v1 18/18] perf bpf-event: Constify variables storing the result of strchr() on const tables Shreenidhi Shedi
@ 2026-05-10 16:25 ` Greg KH
18 siblings, 0 replies; 20+ messages in thread
From: Greg KH @ 2026-05-10 16:25 UTC (permalink / raw)
To: Shreenidhi Shedi; +Cc: acme, linux, mikhail.v.gavrilov, linux-kernel
On Sat, May 09, 2026 at 11:05:41PM +0530, Shreenidhi Shedi wrote:
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
>
> Hi all,
>
> This patch series backports a number of patches from master to 6.1.y
> to fix `-Wdiscarded-qualifiers` and `-Wnonnull` build issues with
> newer glibc versions.
>
> Arnaldo Carvalho de Melo (12):
> perf diff: Constify strchr() return variables
> perf test bpf: Address error about non-null argument for epoll_pwait
> 2nd arg
> perf trace: Deal with compiler const checks
> perf tools: Use const for variables receiving str{str,r?chr}() returns
> perf strlist: Don't write to const memory
> perf metricgroup: Constify variables storing the result of strchr() on
> const tables
> perf session: Don't write to memory pointed to a const pointer
> perf trace-event: Constify variables storing the result of strchr() on
> const tables
> perf units: Constify variables storing the result of strchr() on const
> tables
> perf time-utils: Constify variables storing the result of strchr() on
> const tables
> perf demangle-java: Constify variables storing the result of strchr()
> on const tables
> perf bpf-event: Constify variables storing the result of strchr() on
> const tables
>
> Dr. David Alan Gilbert (1):
> perf tools: Remove unused color_fwrite_lines
>
> Mikhail Gavrilov (1):
> libbpf: Fix -Wdiscarded-qualifiers under C23
>
> Shreenidhi Shedi (4):
> perf list: Fix -Wdiscarded-qualifiers under C23
> perf parse-events: Fix -Wdiscarded-qualifiers under C23
> perf bpf: Fix -Wdiscarded-qualifiers under C23
> perf parse-events:: Fix -Wdiscarded-qualifiers under C23
>
> tools/lib/bpf/libbpf.c | 2 +-
> tools/perf/builtin-diff.c | 12 +++++-------
> tools/perf/builtin-list.c | 3 ++-
> tools/perf/builtin-trace.c | 2 +-
> tools/perf/jvmti/libjvmti.c | 2 +-
> tools/perf/tests/bpf.c | 3 ++-
> tools/perf/util/bpf-event.c | 3 ++-
> tools/perf/util/bpf-loader.c | 2 +-
> tools/perf/util/color.c | 28 ----------------------------
> tools/perf/util/color.h | 1 -
> tools/perf/util/demangle-java.c | 2 +-
> tools/perf/util/evlist.c | 3 ++-
> tools/perf/util/metricgroup.c | 3 +--
> tools/perf/util/parse-events.c | 2 +-
> tools/perf/util/print-events.c | 4 ++--
> tools/perf/util/session.c | 6 +++---
> tools/perf/util/strlist.c | 12 ++++++++----
> tools/perf/util/time-utils.c | 4 ++--
> tools/perf/util/trace-event-info.c | 2 +-
> tools/perf/util/units.c | 2 +-
> 20 files changed, 37 insertions(+), 61 deletions(-)
>
> --
> 2.54.0
>
<formletter>
This is not the correct way to submit patches for inclusion in the
stable kernel tree. Please read:
https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.
</formletter>
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2026-05-10 16:25 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-09 17:35 [PATCH v1 00/18] Backport fixes for -Wdiscarded-qualifiers and -Wnonnull with newer glibc Shreenidhi Shedi
2026-05-09 17:35 ` [PATCH v1 01/18] libbpf: Fix -Wdiscarded-qualifiers under C23 Shreenidhi Shedi
2026-05-09 17:35 ` [PATCH v1 02/18] perf diff: Constify strchr() return variables Shreenidhi Shedi
2026-05-09 17:35 ` [PATCH v1 03/18] perf test bpf: Address error about non-null argument for epoll_pwait 2nd arg Shreenidhi Shedi
2026-05-09 17:35 ` [PATCH v1 04/18] perf list: Fix -Wdiscarded-qualifiers under C23 Shreenidhi Shedi
2026-05-09 17:35 ` [PATCH v1 05/18] perf trace: Deal with compiler const checks Shreenidhi Shedi
2026-05-09 17:35 ` [PATCH v1 06/18] perf tools: Use const for variables receiving str{str,r?chr}() returns Shreenidhi Shedi
2026-05-09 17:35 ` [PATCH v1 07/18] perf parse-events: Fix -Wdiscarded-qualifiers under C23 Shreenidhi Shedi
2026-05-09 17:35 ` [PATCH v1 08/18] perf tools: Remove unused color_fwrite_lines Shreenidhi Shedi
2026-05-09 17:35 ` [PATCH v1 09/18] perf strlist: Don't write to const memory Shreenidhi Shedi
2026-05-09 17:35 ` [PATCH v1 10/18] perf metricgroup: Constify variables storing the result of strchr() on const tables Shreenidhi Shedi
2026-05-09 17:35 ` [PATCH v1 11/18] perf session: Don't write to memory pointed to a const pointer Shreenidhi Shedi
2026-05-09 17:35 ` [PATCH v1 12/18] perf trace-event: Constify variables storing the result of strchr() on const tables Shreenidhi Shedi
2026-05-09 17:35 ` [PATCH v1 13/18] perf units: " Shreenidhi Shedi
2026-05-09 17:35 ` [PATCH v1 14/18] perf bpf: Fix -Wdiscarded-qualifiers under C23 Shreenidhi Shedi
2026-05-09 17:35 ` [PATCH v1 15/18] perf time-utils: Constify variables storing the result of strchr() on const tables Shreenidhi Shedi
2026-05-09 17:35 ` [PATCH v1 16/18] perf demangle-java: " Shreenidhi Shedi
2026-05-09 17:35 ` [PATCH v1 17/18] perf parse-events:: Fix -Wdiscarded-qualifiers under C23 Shreenidhi Shedi
2026-05-09 17:35 ` [PATCH v1 18/18] perf bpf-event: Constify variables storing the result of strchr() on const tables Shreenidhi Shedi
2026-05-10 16:25 ` [PATCH v1 00/18] Backport fixes for -Wdiscarded-qualifiers and -Wnonnull with newer glibc Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox