Skip to content

Commit 0f5d172

Browse files
heicarstgregkh
authored andcommitted
s390/uaccess: get_user() should zero on failure (again)
commit d09c5373e8e4eaaa09233552cbf75dc4c4f21203 upstream. Commit fd2d2b191fe7 ("s390: get_user() should zero on failure") intended to fix s390's get_user() implementation which did not zero the target operand if the read from user space faulted. Unfortunately the patch has no effect: the corresponding inline assembly specifies that the operand is only written to ("=") and the previous value is discarded. Therefore the compiler is free to and actually does omit the zero initialization. To fix this simply change the contraint modifier to "+", so the compiler cannot omit the initialization anymore. Fixes: c9ca784 ("s390/uaccess: provide inline variants of get_user/put_user") Fixes: fd2d2b191fe7 ("s390: get_user() should zero on failure") Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 765ee8c commit 0f5d172

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

arch/s390/include/asm/uaccess.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ unsigned long __must_check __copy_to_user(void __user *to, const void *from,
150150
" jg 2b\n" \
151151
".popsection\n" \
152152
EX_TABLE(0b,3b) EX_TABLE(1b,3b) \
153-
: "=d" (__rc), "=Q" (*(to)) \
153+
: "=d" (__rc), "+Q" (*(to)) \
154154
: "d" (size), "Q" (*(from)), \
155155
"d" (__reg0), "K" (-EFAULT) \
156156
: "cc"); \

0 commit comments

Comments
 (0)