Skip to content

Commit 3680785

Browse files
committed
x86: get rid of 'rtype' argument to __put_user_goto() macro
The 'rtype' argument goes back to pre-git (and pre-BK) times, and comes from the fact that we used to not necessarily have the same type sizes for the arguments of the inline asm as we did for the actual accesses we did. So 'rtype' is the 'register type' - the override of the register size in the inline asm when it doesn't match the actual size of the variable we use as the output argument (for when you used "put_user()" on an "int" value that was assigned to a byte-sized user space access etc). That mismatch doesn't actually exist any more, and should probably never have existed in the first place. It's a horrid bug just waiting to happen (using more - or less - of the variable that the compiler expected us to use). I think we had some odd casting going on to hide the effects of that oddity after-the-fact, but those are long gone, and these days we should always have the right size value in the first place, using things like __typeof__(*(ptr)) __pu_val = (x); and gcc should thus have the right register size without any manual 'rtype' games. Signed-off-by: Linus Torvalds <[email protected]>
1 parent 1a323ea commit 3680785

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

arch/x86/include/asm/uaccess.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ __typeof__(__builtin_choose_expr(sizeof(x) > sizeof(0UL), 0ULL, 0UL))
198198
: "A" ((typeof(*(ptr)))(x)), "c" (ptr) : "ebx")
199199
#else
200200
#define __put_user_goto_u64(x, ptr, label) \
201-
__put_user_goto(x, ptr, "q", "", "er", label)
201+
__put_user_goto(x, ptr, "q", "er", label)
202202
#define __put_user_x8(x, ptr, __ret_pu) __put_user_x(8, x, ptr, __ret_pu)
203203
#endif
204204

@@ -262,13 +262,13 @@ do { \
262262
__chk_user_ptr(ptr); \
263263
switch (size) { \
264264
case 1: \
265-
__put_user_goto(x, ptr, "b", "b", "iq", label); \
265+
__put_user_goto(x, ptr, "b", "iq", label); \
266266
break; \
267267
case 2: \
268-
__put_user_goto(x, ptr, "w", "w", "ir", label); \
268+
__put_user_goto(x, ptr, "w", "ir", label); \
269269
break; \
270270
case 4: \
271-
__put_user_goto(x, ptr, "l", "k", "ir", label); \
271+
__put_user_goto(x, ptr, "l", "ir", label); \
272272
break; \
273273
case 8: \
274274
__put_user_goto_u64(x, ptr, label); \
@@ -376,10 +376,10 @@ struct __large_struct { unsigned long buf[100]; };
376376
* we do not write to any memory gcc knows about, so there are no
377377
* aliasing issues.
378378
*/
379-
#define __put_user_goto(x, addr, itype, rtype, ltype, label) \
379+
#define __put_user_goto(x, addr, itype, ltype, label) \
380380
asm_volatile_goto("\n" \
381-
"1: mov"itype" %"rtype"0,%1\n" \
382-
_ASM_EXTABLE_UA(1b, %l2) \
381+
"1: mov"itype" %0,%1\n" \
382+
_ASM_EXTABLE_UA(1b, %l2) \
383383
: : ltype(x), "m" (__m(addr)) \
384384
: : label)
385385

0 commit comments

Comments
 (0)