From: Namhyung Kim <namhyung@kernel.org>
To: Li Dong <lidong@vivo.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
Sean Christopherson <seanjc@google.com>,
"open list:PERFORMANCE EVENTS SUBSYSTEM"
<linux-perf-users@vger.kernel.org>,
"open list:PERFORMANCE EVENTS SUBSYSTEM"
<linux-kernel@vger.kernel.org>,
opensource.kernel@vivo.com
Subject: Re: [PATCH] tools: Fix incorrect calculation of object size by sizeof
Date: Tue, 20 Jun 2023 12:19:07 -0700 [thread overview]
Message-ID: <CAM9d7chHMH-uJryUVBYZ6emrGLVH8Huc5frDz4YqG7TU29G-6A@mail.gmail.com> (raw)
In-Reply-To: <20230619082036.410-1-lidong@vivo.com>
Hello,
On Mon, Jun 19, 2023 at 1:21 AM Li Dong <lidong@vivo.com> wrote:
>
> What we need to calculate is the size of the object, not the size of the
> pointer.
>
> Signed-off-by: Li Dong <lidong@vivo.com>
Since this problem was introduced in the current dev cycle and not in the
mainline yet, I think we can skip the Fixes tag.
Acked-by: Namhyung Kim <namhyung@kernel.org>
Thanks,
Namhyung
> ---
> 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
>
next prev parent reply other threads:[~2023-06-20 19:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-19 8:20 [PATCH] tools: Fix incorrect calculation of object size by sizeof Li Dong
2023-06-20 19:19 ` Namhyung Kim [this message]
[not found] ` <CA+JHD93f_c8OJf4Kg68C_Xo=_rcO669G0QJ_mjL78upLmUwfoA@mail.gmail.com>
2023-06-20 22:42 ` Namhyung Kim
2023-06-21 17:26 ` Namhyung Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAM9d7chHMH-uJryUVBYZ6emrGLVH8Huc5frDz4YqG7TU29G-6A@mail.gmail.com \
--to=namhyung@kernel.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=lidong@vivo.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=opensource.kernel@vivo.com \
--cc=peterz@infradead.org \
--cc=seanjc@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).