diff options
author | Chris Metcalf <cmetcalf@ezchip.com> | 2015-01-13 14:39:05 -0500 |
---|---|---|
committer | Chris Metcalf <cmetcalf@ezchip.com> | 2015-01-13 18:44:17 -0500 |
commit | f3c927125fa49a42d596434d1ed454195c0d4530 (patch) | |
tree | 80fc76e45b361fe5021861bc8e2d57a46048c0c0 /arch/tile/include/asm/uaccess.h | |
parent | e9118a4914e47e915952842828401779f09cecb8 (diff) |
tile: fix put_user sparse errors
Use x86's __inttype macro instead of using the typeof(x-x) trick to
generate a suitable integer size type. This avoids a sparse warning
when examining the x-x type with a bitwise type.
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Chris Metcalf <cmetcalf@ezchip.com>
Diffstat (limited to 'arch/tile/include/asm/uaccess.h')
-rw-r--r-- | arch/tile/include/asm/uaccess.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/arch/tile/include/asm/uaccess.h b/arch/tile/include/asm/uaccess.h index b6cde3209b96..b81b24a8489b 100644 --- a/arch/tile/include/asm/uaccess.h +++ b/arch/tile/include/asm/uaccess.h | |||
@@ -114,14 +114,14 @@ struct exception_table_entry { | |||
114 | extern int fixup_exception(struct pt_regs *regs); | 114 | extern int fixup_exception(struct pt_regs *regs); |
115 | 115 | ||
116 | /* | 116 | /* |
117 | * This is a type: either unsigned long, if the argument fits into | ||
118 | * that type, or otherwise unsigned long long. | ||
119 | */ | ||
120 | #define __inttype(x) \ | ||
121 | __typeof__(__builtin_choose_expr(sizeof(x) > sizeof(0UL), 0ULL, 0UL)) | ||
122 | |||
123 | /* | ||
117 | * Support macros for __get_user(). | 124 | * Support macros for __get_user(). |
118 | * | ||
119 | * Implementation note: The "case 8" logic of casting to the type of | ||
120 | * the result of subtracting the value from itself is basically a way | ||
121 | * of keeping all integer types the same, but casting any pointers to | ||
122 | * ptrdiff_t, i.e. also an integer type. This way there are no | ||
123 | * questionable casts seen by the compiler on an ILP32 platform. | ||
124 | * | ||
125 | * Note that __get_user() and __put_user() assume proper alignment. | 125 | * Note that __get_user() and __put_user() assume proper alignment. |
126 | */ | 126 | */ |
127 | 127 | ||
@@ -178,7 +178,7 @@ extern int fixup_exception(struct pt_regs *regs); | |||
178 | "9:" \ | 178 | "9:" \ |
179 | : "=r" (ret), "=r" (__a), "=&r" (__b) \ | 179 | : "=r" (ret), "=r" (__a), "=&r" (__b) \ |
180 | : "r" (ptr), "i" (-EFAULT)); \ | 180 | : "r" (ptr), "i" (-EFAULT)); \ |
181 | (x) = (__typeof(x))(__typeof((x)-(x))) \ | 181 | (x) = (__force __typeof(x))(__inttype(x)) \ |
182 | (((u64)__hi32(__a, __b) << 32) | \ | 182 | (((u64)__hi32(__a, __b) << 32) | \ |
183 | __lo32(__a, __b)); \ | 183 | __lo32(__a, __b)); \ |
184 | }) | 184 | }) |
@@ -246,7 +246,7 @@ extern int __get_user_bad(void) | |||
246 | #define __put_user_4(x, ptr, ret) __put_user_asm(sw, x, ptr, ret) | 246 | #define __put_user_4(x, ptr, ret) __put_user_asm(sw, x, ptr, ret) |
247 | #define __put_user_8(x, ptr, ret) \ | 247 | #define __put_user_8(x, ptr, ret) \ |
248 | ({ \ | 248 | ({ \ |
249 | u64 __x = (__typeof((x)-(x)))(x); \ | 249 | u64 __x = (__force __inttype(x))(x); \ |
250 | int __lo = (int) __x, __hi = (int) (__x >> 32); \ | 250 | int __lo = (int) __x, __hi = (int) (__x >> 32); \ |
251 | asm volatile("1: { sw %1, %2; addi %0, %1, 4 }\n" \ | 251 | asm volatile("1: { sw %1, %2; addi %0, %1, 4 }\n" \ |
252 | "2: { sw %0, %3; movei %0, 0 }\n" \ | 252 | "2: { sw %0, %3; movei %0, 0 }\n" \ |