lkml.org 
[lkml]   [2015]   [Apr]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH V3 04/25] perf tools: Add AUX area tracing index
On 28/04/15 15:32, Jiri Olsa wrote:
> On Fri, Apr 24, 2015 at 10:29:46PM +0300, Adrian Hunter wrote:
>
> SNIP
>
>> --- a/tools/perf/util/auxtrace.c
>> +++ b/tools/perf/util/auxtrace.c
>> @@ -344,6 +344,33 @@ out_err:
>> return err;
>> }
>>
>> +static int auxtrace_queues__add_indexed_event(struct auxtrace_queues *queues,
>> + struct perf_session *session,
>> + off_t file_offset, size_t sz)
>> +{
>> + union perf_event *event;
>> + int err;
>> + char buf[PERF_SAMPLE_MAX_SIZE];
>> +
>> + err = perf_session__peek_event(session, file_offset, buf,
>> + PERF_SAMPLE_MAX_SIZE, &event, NULL);
>> + if (err)
>> + return err;
>> +
>> + if (event->header.type == PERF_RECORD_AUXTRACE) {
>> + if (event->header.size != sizeof(struct auxtrace_event) ||
>> + event->header.size != sz) {
>> + err = -EINVAL;
>
> getting lost in here
>
> as per auxtrace_mmap__read it looks like we store PERF_RECORD_AUXTRACE event with:
> ev.auxtrace.header.size = sizeof(ev.auxtrace);
>
> and it's followed with more data with size:
> ev.auxtrace.size = size + padding;
>
> so why the check for 'event->header.size != sz' ?

It checks the consistency of the file structure.

But it seems to me that the previous check could be:

event->header.size < sizeof(struct auxtrace_event)

which would allow for the event being made bigger in a backward compatible way.

>
> jirka
>
>> + goto out;
>> + }
>> + file_offset += event->header.size;
>> + err = auxtrace_queues__add_event(queues, session, event,
>> + file_offset, NULL);
>> + }
>> +out:
>> + return err;
>> +}
>
> SNIP
>
>



\
 
 \ /
  Last update: 2015-04-29 14:41    [W:0.093 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site