Skip to contentSkip to conversation

perf parse-events: fix an incompatible pointer

PATCH Applied Ian Rogers 2 participants 4 messages Jun 9, 2020 perf events

lore
Share & tools
lore

Ian Rogers

author reviewer
#0 lore raw

PATCH 1/2 perf parse-events: fix an incompatible pointer

Arrays are pointer types and don't need their address taking.

Fixes 8255718f4bed (perf pmu: Expand PMU events by prefix match)
---
 tools/perf/util/parse-events.y | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/parse-events.y +1 -1
index c4ca932d092d..d4e076c9c2ab 100644
@@ -349,7 +349,7 @@ PE_PMU_EVENT_PRE '-' PE_PMU_EVENT_SUF sep_dc
 	struct list_head *list;
 	char pmu_name[128];
 
-	snprintf(&pmu_name, 128, "%s-%s", $1, $3);
+	snprintf(pmu_name, sizeof(pmu_name), "%s-%s", $1, $3);
 	free($1);
 	free($3);
 	if (parse_events_multi_pmu_add(_parse_state, pmu_name, &list) < 0)
Signature · 1 line
2.27.0.278.ge193c7cf3a9-goog
author reviewer
#1 lore raw

PATCH 2/2 perf parse-events: fix an old style declaration

Fixes a26e47162d76 (perf tools: Move ALLOC_LIST into a function)
---
 tools/perf/util/parse-events.y | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/parse-events.y +1 -1
index d4e076c9c2ab..acef87d9af58 100644
@@ -26,7 +26,7 @@ do { \
 		YYABORT; \
 } while (0)
 
-static struct list_head* alloc_list()
+static struct list_head* alloc_list(void)
 {
 	struct list_head *list;
 
Signature · 1 line
2.27.0.278.ge193c7cf3a9-goog
maintainer Applied
#2 lore raw

Re: [PATCH 2/2] perf parse-events: fix an old style declaration

Em Mon, Jun 08, 2020 at 10:36:10PM -0700, Ian Rogers escreveu:

Quoted 11 lines
Fixes a26e47162d76 (perf tools: Move ALLOC_LIST into a function)
---
 tools/perf/util/parse-events.y | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/parse-events.y +0 -0
index d4e076c9c2ab..acef87d9af58 100644

tools/perf/util/parse-events.y do { \ · line 31

Quoted 7 lines
tools/perf/util/parse-events.y +1 -1
@@ -26,7 +26,7 @@ do { \
 		YYABORT; \
 } while (0)
 
-static struct list_head* alloc_list()
+static struct list_head* alloc_list(void)
 {
 	struct list_head *list;

Thanks, applied.

- Arnaldo

maintainer Applied
#3 lore raw
In reply to Ian Rogers

Em Mon, Jun 08, 2020 at 10:36:09PM -0700, Ian Rogers escreveu:

Quoted 2 lines

Arrays are pointer types and don't need their address taking.

Fixes 8255718f4bed (perf pmu: Expand PMU events by prefix match)

Thanks, applied.

- Arnaldo

Quoted 21 lines
---
 tools/perf/util/parse-events.y | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/parse-events.y +1 -1
index c4ca932d092d..d4e076c9c2ab 100644
@@ -349,7 +349,7 @@ PE_PMU_EVENT_PRE '-' PE_PMU_EVENT_SUF sep_dc
 	struct list_head *list;
 	char pmu_name[128];
 
-	snprintf(&pmu_name, 128, "%s-%s", $1, $3);
+	snprintf(pmu_name, sizeof(pmu_name), "%s-%s", $1, $3);
 	free($1);
 	free($3);
 	if (parse_events_multi_pmu_add(_parse_state, pmu_name, &list) < 0)
Signature · 1 line
2.27.0.278.ge193c7cf3a9-goog
Signature · 1 line
- Arnaldo