[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210309110447.834292-1-tmricht@linux.ibm.com>
Date: Tue, 9 Mar 2021 12:04:47 +0100
From: Thomas Richter <tmricht@...ux.ibm.com>
To: linux-kernel@...r.kernel.org, linux-perf-users@...r.kernel.org,
acme@...nel.org
Cc: svens@...ux.ibm.com, gor@...ux.ibm.com, sumanthk@...ux.ibm.com,
hca@...ux.ibm.com, Thomas Richter <tmricht@...ux.ibm.com>
Subject: [PATCH] tool/perf: Perf build fails on 5.12.0rc2 on s390
perf build fails on 5.12.0rc2 on s390 with this error message:
util/synthetic-events.c: In function
‘__event__synthesize_thread.part.0.isra’:
util/synthetic-events.c:787:19: error: ‘kernel_thread’ may be
used uninitialized in this function [-Werror=maybe-uninitialized]
787 | if (_pid == pid && !kernel_thread) {
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
The build succeeds using command 'make DEBUG=y'.
The variable kernel_thread is set by this function sequence:
__event__synthesize_thread()
| defines bool kernel_thread; as local variable and calls
+--> perf_event__prepare_comm(..., &kernel_thread)
+--> perf_event__get_comm_ids(..., bool *kernel);
On return of this function variable kernel is always
set to true of false.
To prevent this compile error, assign variable kernel_thread
a value when it is defined.
Output after:
[root@...lp76 perf]# make util/synthetic-events.o
....
CC util/synthetic-events.o
[root@...lp76 perf]#
Signed-off-by: Thomas Richter <tmricht@...ux.ibm.com>
---
tools/perf/util/synthetic-events.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/synthetic-events.c b/tools/perf/util/synthetic-events.c
index b698046ec2db..5dd451695f33 100644
--- a/tools/perf/util/synthetic-events.c
+++ b/tools/perf/util/synthetic-events.c
@@ -758,7 +758,7 @@ static int __event__synthesize_thread(union perf_event *comm_event,
for (i = 0; i < n; i++) {
char *end;
pid_t _pid;
- bool kernel_thread;
+ bool kernel_thread = false;
_pid = strtol(dirent[i]->d_name, &end, 10);
if (*end)
--
2.29.2
Powered by blists - more mailing lists