perf build warnings fixes
Subsystems (2)
cover perf build warnings fixes
This patch series fixes the following build warnings:
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:../../../../per-package/linux-tools/host/arm-buildroot-linux-gnueabihf/sysroot/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,
| ^~~~~~~~~~~
cc1: all warnings being treated as errors
In function 'parse_events_term__num',
inlined from 'parse_events_multi_pmu_add' atutil/parse-events.c:1602:6:util/parse-events.c:2653:64: error: array subscript 'YYLTYPE[0]' is partly outside array bounds of 'char[8]' [-Werror=array-bounds]
2653 | .err_term = loc_term ? loc_term->first_column :
0,
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
util/parse-events.c: In function 'parse_events_multi_pmu_add':
util/parse-events.c:1587:15: note: object 'config' of size 8
1587 | char *config;
| ^~~~~~cc1: all warnings being treated as errors
Arnaldo Carvalho de Melo (1):
perf test bpf: Address error about non-null argument for epoll_pwait
2nd arg
Namhyung Kim (1):
perf tools: Fix a asan issue in parse_events_multi_pmu_add()
tools/perf/tests/bpf.c | 3 ++- tools/perf/util/parse-events.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/2 perf tools: Fix a asan issue in parse_events_multi_pmu_add()
From: Namhyung Kim <[email protected]>
commit 66c9598bd8916c6c1319d0100ac916cac89d4b0e upstream.
In the parse_events_multi_pmu_add() it passes the 'config' variable twice to parse_events_term__num() - one for config and another for loc_term. I'm not sure about the second one as it's converted to YYLTYPE variable. Asan reports it like below:
In function ‘parse_events_term__num’,
inlined from ‘parse_events_multi_pmu_add’ at util/parse-events.c:1602:6:
util/parse-events.c:2653:64: error: array subscript ‘YYLTYPE[0]’ is partly outside
array bounds of ‘char[8]’ [-Werror=array-bounds]
2653 | .err_term = loc_term ? loc_term->first_column : 0,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
util/parse-events.c: In function ‘parse_events_multi_pmu_add’:
util/parse-events.c:1587:15: note: object ‘config’ of size 8
1587 | char *config;
| ^~~~~~cc1: all warnings being treated as errors
[florian: Resolve conflict in parse_events_multi_pmu_add() where term
initialization is located inside the PMU scan loop in 5.10.y]
--- tools/perf/util/parse-events.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/parse-events.c +1 -1
@@ -1593,7 +1593,7 @@ int parse_events_multi_pmu_add(struct parse_events_state *parse_state,return -1 ;if (parse_events_term__num (&term,PARSE_EVENTS__TERM_TYPE_USER , - config,1 , false, &config, + config,1 , false,NULL ,NULL ) <0 ) {free (list);free (config);
Signature · 1 line
2.34.1
[email protected]
AI reviewRe: [PATCH stable 5.10 1/2] perf tools: Fix a asan issue in parse_events_multi_pmu_add()
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 14 lines
From: Namhyung Kim <[email protected]>
commit
66c9598bd8916c6c1319d0100ac916cac89d4b0eupstream.In the
parse_events_multi_pmu_add()it passes the 'config' variable twice toparse_events_term__num()- one for config and another forloc_term. I'm not sure about the second one as it's converted to YYLTYPE variable. Asan reports it like below:In function ‘parse_events_term__num’,
inlined from ‘parse_events_multi_pmu_add’ atutil/parse-events.c:1602:6:
util/parse-events.c:2653:64: error: array subscript ‘YYLTYPE[0]’ is partly outside
array bounds of ‘char[8]’ [-Werror=array-bounds]
2653 | .err_term =loc_term?loc_term->first_column: 0,
Quoted 7 lines
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~[ ... ]Signed-off-by Arnaldo Carvalho de Melo <[email protected]>[florian: Resolve conflict in
parse_events_multi_pmu_add()where term
initialization is located inside the PMU scan loop in 5.10.y]Signed-off-by Florian Fainelli <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
PATCH 2/2 perf test bpf: Address error about non-null argument for epoll_pwait 2nd arg
In reply to Florian FainelliFrom: Arnaldo Carvalho de Melo <[email protected]>
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.
--- tools/perf/tests/bpf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/tests/bpf.c +2 -1
@@ -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 ; }
Signature · 1 line
2.34.1
[email protected]
AI reviewRe: [PATCH stable 5.10 2/2] perf test bpf: Address error about non-null argument for epoll_pwait 2nd arg
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 15 lines
From: Arnaldo Carvalho de Melo <[email protected]>
commit
ed847e30f001b207013b6136c264454d7560557fupstream.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 intepoll_pwait(int__epfd, structepoll_event*__events,
| ^~~~~~~~~~~
Quoted 6 lines
[ ... ]Cc Jiri Olsa <[email protected]>Cc Namhyung Kim <[email protected]>Signed-off-by Arnaldo Carvalho de Melo <[email protected]>Signed-off-by Florian Fainelli <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Quoted 1 line
This patch series fixes the following build warnings:
Queued the series for 5.10, thanks.
Signature · 2 lines
Thanks, Sasha