Skip to content

Commit 3beff76

Browse files
committed
x86: use proper parentheses around new uaccess macro argument uses
__get_kernel_nofault() didn't have the parentheses around the use of 'src' and 'dst' macro arguments, making the casts potentially do the wrong thing. The parentheses aren't necessary with the current very limited use in mm/access.c, but it's bad form, and future use-cases might have very unexpected errors as a result. Do the same for unsafe_copy_loop() while at it, although in that case it is an entirely internal x86 uaccess helper macro that isn't used anywhere else and any other use would be invalid anyway. Fixes: fa94111 ("x86: use non-set_fs based maccess routines") Cc: Christoph Hellwig <[email protected]> Cc: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent d1e521a commit 3beff76

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
@@ -504,12 +504,12 @@ do { \
504504
* We want the unsafe accessors to always be inlined and use
505505
* the error labels - thus the macro games.
506506
*/
507-
#define unsafe_copy_loop(dst, src, len, type, label) \
508-
while (len >= sizeof(type)) { \
509-
unsafe_put_user(*(type *)src,(type __user *)dst,label); \
510-
dst += sizeof(type); \
511-
src += sizeof(type); \
512-
len -= sizeof(type); \
507+
#define unsafe_copy_loop(dst, src, len, type, label) \
508+
while (len >= sizeof(type)) { \
509+
unsafe_put_user(*(type *)(src),(type __user *)(dst),label); \
510+
dst += sizeof(type); \
511+
src += sizeof(type); \
512+
len -= sizeof(type); \
513513
}
514514

515515
#define unsafe_copy_to_user(_dst,_src,_len,label) \
@@ -529,7 +529,7 @@ do { \
529529
do { \
530530
int __kr_err; \
531531
\
532-
__get_user_size(*((type *)dst), (__force type __user *)src, \
532+
__get_user_size(*((type *)(dst)), (__force type __user *)(src), \
533533
sizeof(type), __kr_err); \
534534
if (unlikely(__kr_err)) \
535535
goto err_label; \

0 commit comments

Comments
 (0)