Skip to content

Commit 533ab22

Browse files
committed
x86: make the masked_user_access_begin() macro use its argument only once
This doesn't actually matter for any of the current users, but before merging it mainline, make sure we don't have any surprising semantics. We don't actually want to use an inline function here, because we want to allow - but not require - const pointer arguments, and return them as such. But we already had a local auto-type variable, so let's just use it to avoid any possible double evaluation. Signed-off-by: Linus Torvalds <[email protected]>
1 parent 05f4216 commit 533ab22

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

arch/x86/include/asm/uaccess_64.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,9 @@ static inline unsigned long __untagged_addr_remote(struct mm_struct *mm,
5959
* for dense accesses starting at the address.
6060
*/
6161
#define mask_user_address(x) ((typeof(x))((long)(x)|((long)(x)>>63)))
62-
#define masked_user_access_begin(x) ({ \
63-
__auto_type __masked_ptr = mask_user_address(x); \
62+
#define masked_user_access_begin(x) ({ \
63+
__auto_type __masked_ptr = (x); \
64+
__masked_ptr = mask_user_address(__masked_ptr); \
6465
__uaccess_begin(); __masked_ptr; })
6566

6667
/*

0 commit comments

Comments
 (0)