On Tuesday 13 November 2012, Rob Clark wrote:
right, that is what I was worried about.. but what about something along the lines of:
case 8: { \ if (sizeof(x) < 8) \ __get_user_x(__r2, __p, __e, __l, 4); \ else \ __get_user_x(__r2, __p, __e, __l, 8); \ break; \ } \
I guess that's still broken if x is 8 or 16 bits wide.
maybe we need a special variant of __get_user_8() instead to get the right 32bits on big vs little endian systems, but I think something roughly along these lines could work.
Or maybe in sizeof(x)<8 case, we just __get_user_bad().. I'm not 100% sure on whether this is supposed to be treated as an error case at compile time or not.
We know that nobody is using that at the moment, so we could define it to be a compile-time error.
But I still think this is a pointless exercise, a number of people have concluded independently that it's not worth trying to come up with a solution, whether one exists or not. Why can't you just use copy_from_user() anyway?
Arnd