Thread (8 messages) flat view 8 messages, 3 authors, 2024-10-16

Re: [PATCH] tools/perf/tests: Fix compilation error with strncpy in tests/tool_pmu

From: Namhyung Kim <namhyung@kernel.org>
Date: 2024-10-14 17:38:49
Also in: linux-perf-users
Subsystem: performance events subsystem, the rest · Maintainers: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim, Linus Torvalds

On Sun, Oct 13, 2024 at 11:07:42PM +0530, Athira Rajeev wrote:
perf fails to compile on systems with GCC version11
as below:
I have one more build failure on 32 bit systems.  I'll carry this as
well.

Thanks,
Namhyung

---8<---
From 2e2c7ca3691d223d94ea383a6b688e35579d14d5 Mon Sep 17 00:00:00 2001
From: Namhyung Kim <namhyung@kernel.org>
Date: Mon, 14 Oct 2024 10:34:17 -0700
Subject: [PATCH] perf tools: Fix compiler error in util/tool_pmu.c

  util/tool_pmu.c: In function 'evsel__tool_pmu_read':
  util/tool_pmu.c:419:55: error: passing argument 2 of 'tool_pmu__read_event' from incompatible pointer type [-Werror=incompatible-pointer-types]
    419 |                         if (!tool_pmu__read_event(ev, &val)) {
        |                                                       ^~~~
        |                                                       |
        |                                                       long unsigned int *
  util/tool_pmu.c:335:56: note: expected 'u64 *' {aka 'long long unsigned int *'} but argument is of type 'long unsigned int *'
    335 | bool tool_pmu__read_event(enum tool_pmu_event ev, u64 *result)
        |                                                   ~~~~~^~~~~~

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/util/tool_pmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/tool_pmu.c b/tools/perf/util/tool_pmu.c
index ea9d50f0252023dc..bd1cee643eb506df 100644
--- a/tools/perf/util/tool_pmu.c
+++ b/tools/perf/util/tool_pmu.c
@@ -394,7 +394,7 @@ bool tool_pmu__read_event(enum tool_pmu_event ev, u64 *result)
 int evsel__tool_pmu_read(struct evsel *evsel, int cpu_map_idx, int thread)
 {
 	__u64 *start_time, cur_time, delta_start;
-	unsigned long val;
+	u64 val;
 	int fd, err = 0;
 	struct perf_counts_values *count, *old_count = NULL;
 	bool adjust = false;
-- 
2.47.0.rc1.288.g06298d1525-goog

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help