Re: [PATCH 2/4] perf_event: fix getting point

Frederic Weisbecker
2009-12-16T01:22:28Z

On Wed, Dec 16, 2009 at 09:03:47AM +0800, Xiao Guangrong wrote:
> >> @@ -1919,13 +1919,32 @@ raw_field_value(struct event *event, const char *name, void *data)
> >>
> >> void *raw_field_ptr(struct event *event, const char *name, void *data)
> >> {
> >> + void *ptr;
> >> + unsigned long long value;
> >> +
> >> + value = raw_field_value(event, name, data);
> >> +
> >> + if (!value)
> >> + return NULL;
> >> +
> >> + memcpy(&ptr, &value, sizeof(ptr));
> >
> >
> >
> > Could you perhaps just do
> >
> > ptr = (void *)value; ?
> >
>
> We can't do it in x86_32:
> error: cast to pointer from integer of different size

You can just do:

ptr = (void *)(unsigned long)value;