]> xenbits.xensource.com Git - xen.git/commit
x86: polish __{get,put}_user_{,no}check()
authorJan Beulich <jbeulich@suse.com>
Fri, 5 May 2017 15:08:14 +0000 (17:08 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 5 May 2017 15:08:14 +0000 (17:08 +0200)
commit54dba8e6c416b26667e934fc5e9fcd8a1adecfe3
tree77b5de0373625d0c8a48b39d49edb97e31ca8183
parenta5f4edebac284ca50926272093b4aac9b9d12620
x86: polish __{get,put}_user_{,no}check()

The primary purpose is correcting a latent bug in __get_user_check()
(the macro has no active user at present): The access_ok() check should
be before the actual access, or else any PV guest could initiate MMIO
reads with side effects.

Clean up all four macros at once:
- all arguments evaluated exactly once
- build the "check" flavor using the "nocheck" ones, instead of open
  coding them
- "int" is wide enough for error codes
- name local variables without using underscores as prefixes
- avoid pointless parentheses
- add blanks after commas separating parameters or arguments
- consistently use tabs for indentation

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Release-acked-by: Julien grall <julien.grall@arm.com>
xen/include/asm-x86/uaccess.h