[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230619082036.410-1-lidong@vivo.com>
Date: Mon, 19 Jun 2023 16:20:10 +0800
From: Li Dong <lidong@...o.com>
To: Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Ian Rogers <irogers@...gle.com>,
Adrian Hunter <adrian.hunter@...el.com>,
Sean Christopherson <seanjc@...gle.com>,
linux-perf-users@...r.kernel.org (open list:PERFORMANCE EVENTS
SUBSYSTEM),
linux-kernel@...r.kernel.org (open list:PERFORMANCE EVENTS SUBSYSTEM)
Cc: opensource.kernel@...o.com, lidong@...o.com
Subject: [PATCH] tools: Fix incorrect calculation of object size by sizeof
What we need to calculate is the size of the object, not the size of the
pointer.
Signed-off-by: Li Dong <lidong@...o.com>
---
tools/perf/util/scripting-engines/trace-event-python.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c
index 59063ec98619..25fcd6630a4d 100644
--- a/tools/perf/util/scripting-engines/trace-event-python.c
+++ b/tools/perf/util/scripting-engines/trace-event-python.c
@@ -771,12 +771,12 @@ static void set_regs_in_dict(PyObject *dict,
int size = __sw_hweight64(attr->sample_regs_intr) * 28;
char *bf = malloc(size);
- regs_map(&sample->intr_regs, attr->sample_regs_intr, arch, bf, sizeof(bf));
+ regs_map(&sample->intr_regs, attr->sample_regs_intr, arch, bf, size);
pydict_set_item_string_decref(dict, "iregs",
_PyUnicode_FromString(bf));
- regs_map(&sample->user_regs, attr->sample_regs_user, arch, bf, sizeof(bf));
+ regs_map(&sample->user_regs, attr->sample_regs_user, arch, bf, size);
pydict_set_item_string_decref(dict, "uregs",
_PyUnicode_FromString(bf));
--
2.31.1.windows.1
Powered by blists - more mailing lists