diff mbox

x86: fix asm() constraint in clear_user()

Message ID 58581C6F020000780012AA53@prv-mh.provo.novell.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jan Beulich Dec. 19, 2016, 4:44 p.m. UTC
Commit 2fdf5b2554 ("x86: streamline copying to/from user memory")
wrongly used "g" here, when it obviously needs to be a register.

Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
x86: fix asm() constraint in clear_user()

Commit 2fdf5b2554 ("x86: streamline copying to/from user memory")
wrongly used "g" here, when it obviously needs to be a register.

Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/usercopy.c
+++ b/xen/arch/x86/usercopy.c
@@ -141,7 +141,7 @@ unsigned clear_user(void __user *to, uns
             _ASM_EXTABLE(0b,3b)
             _ASM_EXTABLE(1b,2b)
             : [cnt] "=&c" (n), [to] "+D" (to)
-            : [bytes] "g" (n & (BYTES_PER_LONG - 1)),
+            : [bytes] "r" (n & (BYTES_PER_LONG - 1)),
               [longs] "0" (n / BYTES_PER_LONG), "a" (0) );
         clac();
     }

Comments

Andrew Cooper Dec. 19, 2016, 4:46 p.m. UTC | #1
On 19/12/16 16:44, Jan Beulich wrote:
> Commit 2fdf5b2554 ("x86: streamline copying to/from user memory")
> wrongly used "g" here, when it obviously needs to be a register.
>
> Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
diff mbox

Patch

--- a/xen/arch/x86/usercopy.c
+++ b/xen/arch/x86/usercopy.c
@@ -141,7 +141,7 @@  unsigned clear_user(void __user *to, uns
             _ASM_EXTABLE(0b,3b)
             _ASM_EXTABLE(1b,2b)
             : [cnt] "=&c" (n), [to] "+D" (to)
-            : [bytes] "g" (n & (BYTES_PER_LONG - 1)),
+            : [bytes] "r" (n & (BYTES_PER_LONG - 1)),
               [longs] "0" (n / BYTES_PER_LONG), "a" (0) );
         clac();
     }