From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Jiri Olsa <jolsa@redhat.com>
Cc: Ingo Molnar <mingo@kernel.org>,
linux-kernel@vger.kernel.org, Jiri Olsa <jolsa@kernel.org>,
Adrian Hunter <adrian.hunter@intel.com>,
Andi Kleen <ak@linux.intel.com>, David Ahern <dsahern@gmail.com>,
Namhyung Kim <namhyung@kernel.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Stephane Eranian <eranian@google.com>
Subject: Re: [PATCH 12/13] perf thread_map: Change map entries into a struct
Date: Thu, 25 Jun 2015 14:48:40 -0300 [thread overview]
Message-ID: <20150625174840.GH3253@kernel.org> (raw)
In-Reply-To: <20150625134505.GA3253@kernel.org>
Em Thu, Jun 25, 2015 at 10:45:05AM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Thu, Jun 25, 2015 at 10:38:41AM +0200, Jiri Olsa escreveu:
> > and you missed following hunk:
> > ---
> > static struct thread_map *thread_map__realloc(struct thread_map *map, int nr)
> > {
> > - size_t size = sizeof(*map) + sizeof(pid_t) * nr;
> > + size_t size = sizeof(*map) + sizeof(struct thread_map_data) * nr;
> > ---
> > shouldn't be fatal, it probably has the same or biggger size ATM
> > I'll include the fix in the next version
>
> Yeah, sorry about that, should have noticed that, but as you said, code
> wise it is harmless.
Adding this fix for it, should have been there since when I implemented
thread_map...
static struct thread_map *thread_map__realloc(struct thread_map *map,
int nr)
{
- size_t size = sizeof(*map) + sizeof(pid_t) * nr;
+ size_t size = sizeof(*map) + sizeof(map->map[0]) * nr;
-----------
[acme@zoo ~]$ cat thread_map.c
#include <sys/types.h>
#include <stdio.h>
struct thread_map_data {
pid_t pid;
};
struct thread_map {
int nr;
struct thread_map_data map[];
};
int main(void)
{
struct thread_map *map;
printf("sizeof(map->map[0]:\t\t%zd\n", sizeof(map->map[0]));
printf("sizeof(struct thread_map_data):\t%zd\n", sizeof(struct thread_map_data));
printf("sizeof(pid_t):\t\t\t%zd\n", sizeof(pid_t));
return 0;
}
[acme@zoo ~]$ make thread_map
cc thread_map.c -o thread_map
[acme@zoo ~]$ ./thread_map
sizeof(map->map[0]: 4
sizeof(struct thread_map_data): 4
sizeof(pid_t): 4
[acme@zoo ~]$ file thread_map
thread_map: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=a6a9894fb6127e23621ef02e1110ff6635082bcd, not stripped
[acme@zoo ~]$
- Arnaldo
next prev parent reply other threads:[~2015-06-25 17:48 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-23 21:47 [GIT PULL 00/13] perf/core improvements and fixes Arnaldo Carvalho de Melo
2015-06-23 21:47 ` [PATCH 01/13] perf top: Move toggling event logic into hists browser Arnaldo Carvalho de Melo
2015-06-23 21:47 ` [PATCH 02/13] perf tests: Add testing for Makefile.perf Arnaldo Carvalho de Melo
2015-06-23 21:47 ` [PATCH 03/13] perf tests: Add test for make install with prefix Arnaldo Carvalho de Melo
2015-06-23 21:47 ` [PATCH 04/13] perf build: Fix single target build dependency check Arnaldo Carvalho de Melo
2015-06-23 21:47 ` [PATCH 05/13] perf pmu: Use __weak definition from <linux/compiler.h> Arnaldo Carvalho de Melo
2015-06-23 21:47 ` [PATCH 06/13] perf pmu: Split perf_pmu__new_alias() Arnaldo Carvalho de Melo
2015-06-23 21:47 ` [PATCH 07/13] perf tools: Allow events with dot Arnaldo Carvalho de Melo
2015-06-23 21:47 ` [PATCH 08/13] perf session: Print a newline when dumping PERF_RECORD_FINISHED_ROUND Arnaldo Carvalho de Melo
2015-06-23 21:47 ` [PATCH 09/13] perf tools: Print a newline before dumping Aggregated stats Arnaldo Carvalho de Melo
2015-06-23 21:47 ` [PATCH 10/13] perf probe: Fix failure to probe events on arm Arnaldo Carvalho de Melo
2015-06-23 21:47 ` [PATCH 11/13] perf thread_map: Don't access the array entries directly Arnaldo Carvalho de Melo
2015-06-23 21:47 ` [PATCH 12/13] perf thread_map: Change map entries into a struct Arnaldo Carvalho de Melo
2015-06-25 8:38 ` Jiri Olsa
2015-06-25 13:45 ` Arnaldo Carvalho de Melo
2015-06-25 17:48 ` Arnaldo Carvalho de Melo [this message]
2015-06-26 8:43 ` [tip:perf/urgent] perf tools: Future-proof thread_map allocation size calculation tip-bot for Arnaldo Carvalho de Melo
2015-06-23 21:47 ` [PATCH 13/13] perf tools: Allow auxtrace data alignment Arnaldo Carvalho de Melo
2015-06-25 7:31 ` [GIT PULL 00/13] perf/core improvements and fixes Ingo Molnar
2015-06-25 13:48 ` Arnaldo Carvalho de Melo
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=20150625174840.GH3253@kernel.org \
--to=acme@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=adrian.hunter@intel.com \
--cc=ak@linux.intel.com \
--cc=dsahern@gmail.com \
--cc=eranian@google.com \
--cc=jolsa@kernel.org \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.