diff options
author | H. Peter Anvin <hpa@linux.intel.com> | 2014-06-07 01:30:37 +0400 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2014-06-07 01:54:54 +0400 |
commit | bdfb9bcc25005d06a9c301830bdeb7ca5a0b6ef7 (patch) | |
tree | 4598169d540d42653e4dbd320473cb3ea1f6592c /arch/x86/vdso/vdso2c.c | |
parent | a0abcf2e8f8017051830f738ac1bf5ef42703243 (diff) | |
download | linux-bdfb9bcc25005d06a9c301830bdeb7ca5a0b6ef7.tar.xz |
x86, vdso: Use <tools/le_byteshift.h> for littleendian access
There are no standard functions for littleendian data (unlike
bigendian data.) Thus, use <tools/le_byteshift.h> to access
littleendian data members. Those are fairly inefficient, but it
doesn't matter for this purpose (and can be optimized later.) This
avoids portability problems.
Reported-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Tested-by: Andy Lutomirski <luto@amacapital.net>
Link: http://lkml.kernel.org/r/20140606140017.afb7f91142f66cb3dd13c186@linux-foundation.org
Diffstat (limited to 'arch/x86/vdso/vdso2c.c')
-rw-r--r-- | arch/x86/vdso/vdso2c.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/arch/x86/vdso/vdso2c.c b/arch/x86/vdso/vdso2c.c index deabaf5bfb89..450ac6eaf613 100644 --- a/arch/x86/vdso/vdso2c.c +++ b/arch/x86/vdso/vdso2c.c @@ -11,6 +11,8 @@ #include <sys/mman.h> #include <sys/types.h> +#include <tools/le_byteshift.h> + #include <linux/elf.h> #include <linux/types.h> @@ -56,12 +58,12 @@ static void fail(const char *format, ...) */ #define GLE(x, bits, ifnot) \ __builtin_choose_expr( \ - (sizeof(x) == bits/8), \ - (__typeof__(x))le##bits##toh(x), ifnot) + (sizeof(*(x)) == bits/8), \ + (__typeof__(*(x)))get_unaligned_le##bits(x), ifnot) -extern void bad_get_le(uint64_t); +extern void bad_get_le(void); #define LAST_LE(x) \ - __builtin_choose_expr(sizeof(x) == 1, (x), bad_get_le(x)) + __builtin_choose_expr(sizeof(*(x)) == 1, *(x), bad_get_le()) #define GET_LE(x) \ GLE(x, 64, GLE(x, 32, GLE(x, 16, LAST_LE(x)))) |