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

From: Frederic Weisbecker
Date: Tue Dec 15 2009 - 20:22:30 EST


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;

--
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/