diff options
author | Arnd Bergmann <arnd@arndb.de> | 2015-01-14 17:17:49 -0500 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2015-01-14 17:17:49 -0500 |
commit | 643165c8bbc8617d8222cb50c89e34fe64d226cf (patch) | |
tree | e2a88de9b8efb0c9fa2436f53b0a3ab4948c4a55 /arch/m68k | |
parent | eaa27f34e91a14cdceed26ed6c6793ec1d186115 (diff) | |
parent | 0795cb1b46e7938ed679ccd48f933e75272b30e3 (diff) |
Merge tag 'uaccess_for_upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost into asm-generic
Merge "uaccess: fix sparse warning on get/put_user for bitwise types" from Michael S. Tsirkin:
At the moment, if p and x are both tagged as bitwise types,
some of get_user(x, p), put_user(x, p), __get_user(x, p), __put_user(x, p)
might produce a sparse warning on many architectures.
This is a false positive: *p on these architectures is loaded into long
(typically using asm), then cast back to typeof(*p).
When typeof(*p) is a bitwise type (which is uncommon), such a cast needs
__force, otherwise sparse produces a warning.
Some architectures already have the __force tag, add it
where it's missing.
I verified that adding these __force casts does not supress any useful warnings.
Specifically, vhost wants to read/write bitwise types in userspace memory
using get_user/put_user.
At the moment this triggers sparse errors, since the value is passed through an
integer.
For example:
__le32 __user *p;
__u32 x;
both
put_user(x, p);
and
get_user(x, p);
should be safe, but produce warnings on some architectures.
While there, I noticed that a bunch of architectures violated
coding style rules within uaccess macros.
Included patches to fix them up.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
* tag 'uaccess_for_upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost: (37 commits)
sparc32: nocheck uaccess coding style tweaks
sparc64: nocheck uaccess coding style tweaks
xtensa: macro whitespace fixes
sh: macro whitespace fixes
parisc: macro whitespace fixes
m68k: macro whitespace fixes
m32r: macro whitespace fixes
frv: macro whitespace fixes
cris: macro whitespace fixes
avr32: macro whitespace fixes
arm64: macro whitespace fixes
arm: macro whitespace fixes
alpha: macro whitespace fixes
blackfin: macro whitespace fixes
sparc64: uaccess_64 macro whitespace fixes
sparc32: uaccess_32 macro whitespace fixes
avr32: whitespace fix
sh: fix put_user sparse errors
metag: fix put_user sparse errors
ia64: fix put_user sparse errors
...
Diffstat (limited to 'arch/m68k')
-rw-r--r-- | arch/m68k/include/asm/segment.h | 2 | ||||
-rw-r--r-- | arch/m68k/include/asm/uaccess_mm.h | 40 |
2 files changed, 21 insertions, 21 deletions
diff --git a/arch/m68k/include/asm/segment.h b/arch/m68k/include/asm/segment.h index 0fa80e97ed2d..98216b8111f0 100644 --- a/arch/m68k/include/asm/segment.h +++ b/arch/m68k/include/asm/segment.h | |||
@@ -58,7 +58,7 @@ static inline mm_segment_t get_ds(void) | |||
58 | #define set_fs(x) (current_thread_info()->addr_limit = (x)) | 58 | #define set_fs(x) (current_thread_info()->addr_limit = (x)) |
59 | #endif | 59 | #endif |
60 | 60 | ||
61 | #define segment_eq(a,b) ((a).seg == (b).seg) | 61 | #define segment_eq(a, b) ((a).seg == (b).seg) |
62 | 62 | ||
63 | #endif /* __ASSEMBLY__ */ | 63 | #endif /* __ASSEMBLY__ */ |
64 | 64 | ||
diff --git a/arch/m68k/include/asm/uaccess_mm.h b/arch/m68k/include/asm/uaccess_mm.h index 15901db435b9..d228601b3afc 100644 --- a/arch/m68k/include/asm/uaccess_mm.h +++ b/arch/m68k/include/asm/uaccess_mm.h | |||
@@ -128,25 +128,25 @@ asm volatile ("\n" \ | |||
128 | #define put_user(x, ptr) __put_user(x, ptr) | 128 | #define put_user(x, ptr) __put_user(x, ptr) |
129 | 129 | ||
130 | 130 | ||
131 | #define __get_user_asm(res, x, ptr, type, bwl, reg, err) ({ \ | 131 | #define __get_user_asm(res, x, ptr, type, bwl, reg, err) ({ \ |
132 | type __gu_val; \ | 132 | type __gu_val; \ |
133 | asm volatile ("\n" \ | 133 | asm volatile ("\n" \ |
134 | "1: "MOVES"."#bwl" %2,%1\n" \ | 134 | "1: "MOVES"."#bwl" %2,%1\n" \ |
135 | "2:\n" \ | 135 | "2:\n" \ |
136 | " .section .fixup,\"ax\"\n" \ | 136 | " .section .fixup,\"ax\"\n" \ |
137 | " .even\n" \ | 137 | " .even\n" \ |
138 | "10: move.l %3,%0\n" \ | 138 | "10: move.l %3,%0\n" \ |
139 | " sub.l %1,%1\n" \ | 139 | " sub.l %1,%1\n" \ |
140 | " jra 2b\n" \ | 140 | " jra 2b\n" \ |
141 | " .previous\n" \ | 141 | " .previous\n" \ |
142 | "\n" \ | 142 | "\n" \ |
143 | " .section __ex_table,\"a\"\n" \ | 143 | " .section __ex_table,\"a\"\n" \ |
144 | " .align 4\n" \ | 144 | " .align 4\n" \ |
145 | " .long 1b,10b\n" \ | 145 | " .long 1b,10b\n" \ |
146 | " .previous" \ | 146 | " .previous" \ |
147 | : "+d" (res), "=&" #reg (__gu_val) \ | 147 | : "+d" (res), "=&" #reg (__gu_val) \ |
148 | : "m" (*(ptr)), "i" (err)); \ | 148 | : "m" (*(ptr)), "i" (err)); \ |
149 | (x) = (typeof(*(ptr)))(unsigned long)__gu_val; \ | 149 | (x) = (__force typeof(*(ptr)))(__force unsigned long)__gu_val; \ |
150 | }) | 150 | }) |
151 | 151 | ||
152 | #define __get_user(x, ptr) \ | 152 | #define __get_user(x, ptr) \ |
@@ -188,7 +188,7 @@ asm volatile ("\n" \ | |||
188 | "+a" (__gu_ptr) \ | 188 | "+a" (__gu_ptr) \ |
189 | : "i" (-EFAULT) \ | 189 | : "i" (-EFAULT) \ |
190 | : "memory"); \ | 190 | : "memory"); \ |
191 | (x) = (typeof(*(ptr)))__gu_val; \ | 191 | (x) = (__force typeof(*(ptr)))__gu_val; \ |
192 | break; \ | 192 | break; \ |
193 | } */ \ | 193 | } */ \ |
194 | default: \ | 194 | default: \ |