From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Jiri Olsa <jolsa@redhat.com>
Cc: Dmitry Koshelev <karaghiozis@gmail.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Namhyung Kim <namhyung@kernel.org>,
Adrian Hunter <adrian.hunter@intel.com>,
Kan Liang <kan.liang@linux.intel.com>,
Leo Yan <leo.yan@linaro.org>,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] perf: Fix swapping of cpu_map and stat_config records
Date: Sat, 8 May 2021 12:15:49 -0300 [thread overview]
Message-ID: <YJarJWbjlhizmt5A@kernel.org> (raw)
In-Reply-To: <YJPv2u6NBuYX9FUX@krava>
Em Thu, May 06, 2021 at 03:32:10PM +0200, Jiri Olsa escreveu:
> On Thu, May 06, 2021 at 01:11:49PM +0000, Dmitry Koshelev wrote:
> > 'data' field in perf_record_cpu_map_data struct is 16-bit
> > wide and so should be swapped using bswap_16().
> >
> > 'nr' field in perf_record_stat_config struct should be
> > swapped before being used for size calculation.
> >
> > Signed-off-by: Dmitry Koshelev <karaghiozis@gmail.com>
>
> Acked-by: Jiri Olsa <jolsa@redhat.com>
Thanks, applied.
- Arnaldo
> thanks,
> jirka
>
> > ---
> > tools/perf/util/session.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
> > index a12cf4f0e97a..106b3d60881a 100644
> > --- a/tools/perf/util/session.c
> > +++ b/tools/perf/util/session.c
> > @@ -904,7 +904,7 @@ static void perf_event__cpu_map_swap(union perf_event *event,
> > struct perf_record_record_cpu_map *mask;
> > unsigned i;
> >
> > - data->type = bswap_64(data->type);
> > + data->type = bswap_16(data->type);
> >
> > switch (data->type) {
> > case PERF_CPU_MAP__CPUS:
> > @@ -937,7 +937,7 @@ static void perf_event__stat_config_swap(union perf_event *event,
> > {
> > u64 size;
> >
> > - size = event->stat_config.nr * sizeof(event->stat_config.data[0]);
> > + size = bswap_64(event->stat_config.nr) * sizeof(event->stat_config.data[0]);
> > size += 1; /* nr item itself */
> > mem_bswap_64(&event->stat_config.nr, size);
> > }
> > --
> > 2.25.1
> >
>
--
- Arnaldo
prev parent reply other threads:[~2021-05-08 15:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-06 13:11 [PATCH] perf: Fix swapping of cpu_map and stat_config records Dmitry Koshelev
2021-05-06 13:32 ` Jiri Olsa
2021-05-08 15:15 ` Arnaldo Carvalho de Melo [this message]
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=YJarJWbjlhizmt5A@kernel.org \
--to=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=jolsa@redhat.com \
--cc=kan.liang@linux.intel.com \
--cc=karaghiozis@gmail.com \
--cc=leo.yan@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
/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).