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

From: OGAWA Hirofumi
Date: Mon Dec 07 2009 - 01:36:06 EST


OGAWA Hirofumi <hirofumi@xxxxxxxxxxxxxxxxxx> writes:

> Xiao Guangrong <xiaoguangrong@xxxxxxxxxxxxxx> writes:
>
>> raw->size is not used, this patch just cleanup it
>
> Oops, I didn't notice those. Thanks.
>
>> Signed-off-by: Xiao Guangrong <xiaoguangrong@xxxxxxxxxxxxxx>
>> ---
>> 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@xxxxxxxxxxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/