[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALcN6miWeAuqnvJO1N2z3j2Uv7PRfdAi6p_xxpZ2L=eqbPo6tg@mail.gmail.com>
Date: Tue, 11 Jul 2017 17:32:40 -0700
From: David Carrillo-Cisneros <davidcc@...gle.com>
To: Jiri Olsa <jolsa@...hat.com>
Cc: linux-kernel <linux-kernel@...r.kernel.org>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Andi Kleen <ak@...ux.intel.com>, Simon Que <sque@...omium.org>,
Wang Nan <wangnan0@...wei.com>, Jiri Olsa <jolsa@...nel.org>,
He Kuang <hekuang@...wei.com>,
Masami Hiramatsu <mhiramat@...nel.org>,
Stephane Eranian <eranian@...gle.com>,
Paul Turner <pjt@...gle.com>
Subject: Re: [PATCH v4 15/16] perf tools: add feature header record to pipe-mode
On Tue, Jun 13, 2017 at 11:54 AM, Jiri Olsa <jolsa@...hat.com> wrote:
> On Mon, Jun 12, 2017 at 09:29:31PM -0700, David Carrillo-Cisneros wrote:
>
> SNIP
>
>>
>> void perf_event__print_totals(void);
>> diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
>> index ddfaf157913d..6f6a54c15cb0 100644
>> --- a/tools/perf/util/header.c
>> +++ b/tools/perf/util/header.c
>> @@ -34,6 +34,7 @@
>> #include "data.h"
>> #include <api/fs/fs.h>
>> #include "asm/bug.h"
>> +#include "tool.h"
>>
>> #include "sane_ctype.h"
>>
>> @@ -97,11 +98,14 @@ static int __do_write_buf(struct feat_fd *ff, const void *buf, size_t size)
>>
>> retry:
>> if (size > (ff->size - ff->offset)) {
>> - addr = realloc(ff->buf, ff->size << 1);
>> + size = ff->size << 1;
>> + if (size > page_size)
>
> event size could be 0xffff - sizeof(struct perf_event_header)
> also the initial size is most likely > page_size anyway
>
> please put this into the patch that introduced __do_write_buf
>
Thank you for reviewing this. I just realized that I sent v5 without
properly addressing this issue. In v4 I tried to add a quick check
without properly understanding the issue. Why is 0xffff the maximum
size for an event? where is this constraint coming from?
Thanks,
David
Powered by blists - more mailing lists