Re: [PATCH] perf_event: fix for processing raw event - fix

OGAWA Hirofumi
2009-12-07T06:35:56Z

OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> writes:

> Xiao Guangrong <xiaoguangrong@cn.fujitsu.com> writes:
>
>> raw->size is not used, this patch just cleanup it
>
> Oops, I didn't notice those. Thanks.
>
>> Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
>> ---
>> tools/perf/builtin-kmem.c | 38 +++++++-----------
>> tools/perf/builtin-sched.c | 94 +++++++++++++++++++------------------------
>> 2 files changed, 56 insertions(+), 76 deletions(-)
>>
>> diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c
>> index f84d7a3..7551a5f 100644
>> --- a/tools/perf/builtin-kmem.c
>> +++ b/tools/perf/builtin-kmem.c
>> @@ -57,11 +57,6 @@ static struct rb_root root_caller_sorted;
>> static unsigned long total_requested, total_allocated;
>> static unsigned long nr_allocs, nr_cross_allocs;
>>
>> -struct raw_event_sample {
>> - u32 size;
>> - char data[0];
>> -};
>> -
>> #define PATH_SYS_NODE "/sys/devices/system/node"
>>
>> static void init_cpunode_map(void)
>> @@ -201,7 +196,7 @@ static void insert_caller_stat(unsigned long call_site,
>> }
>> }
>>
>> -static void process_alloc_event(struct raw_event_sample *raw,
>> +static void process_alloc_event(void *data,
>> struct event *event,
>> int cpu,
>> u64 timestamp __used,
>
> How about the following patch instead of playing with unsafe "void *"?
> With this, I guess it does type check, and filed handling functions can

s/filed handling/field handling of sample raw data/

> check "size" by passing "struct sample_raw_data" instead of "void *" in
> future.
--
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>