Re: [PATCH] staging: comedi: remove __user annotation inside ofstruct's

From: Dan Carpenter
Date: Wed May 09 2012 - 10:16:29 EST


On Wed, May 09, 2012 at 12:01:25PM +0100, Ian Abbott wrote:
> Are there any handy macros for casting pointers to __user pointers,
> something like
>
> #define _user(p) ((typeof(*(p)) __user *)(p))
>
> but preferably without the repeated expansion of 'p' in case of
> side-effects?

typeof() doesn't have side effects.

#include <stdio.h>

int main(void)
{
int x = 0;
typeof(x++) y;

printf("%d\n", x);

return 0;
}

regards,
dan carpenter
--
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/