From cfa785e623577cdad2aa721acb23bd3a95eced9a Mon Sep 17 00:00:00 2001 From: Heiko Carstens Date: Wed, 22 Jan 2014 14:49:30 +0100 Subject: s390/uaccess: normalize order of parameters of indirect uaccess function calls For some unknown reason the indirect uaccess functions on s390 implement a different parameter order than what is usual. e.g.: unsigned long copy_to_user(void *to, const void *from, unsigned long n); vs. size_t (*copy_to_user)(size_t n, void __user * to, const void *from); Let's get rid of this confusing parameter reordering. Signed-off-by: Heiko Carstens Signed-off-by: Martin Schwidefsky --- arch/s390/lib/uaccess_mvcos.c | 20 ++++++++++---------- arch/s390/lib/uaccess_pt.c | 34 +++++++++++++++++----------------- 2 files changed, 27 insertions(+), 27 deletions(-) (limited to 'arch/s390/lib') diff --git a/arch/s390/lib/uaccess_mvcos.c b/arch/s390/lib/uaccess_mvcos.c index 4b7993bf69b9..95123f57aaf8 100644 --- a/arch/s390/lib/uaccess_mvcos.c +++ b/arch/s390/lib/uaccess_mvcos.c @@ -26,7 +26,7 @@ #define SLR "slgr" #endif -static size_t copy_from_user_mvcos(size_t size, const void __user *ptr, void *x) +static size_t copy_from_user_mvcos(void *x, const void __user *ptr, size_t size) { register unsigned long reg0 asm("0") = 0x81UL; unsigned long tmp1, tmp2; @@ -65,7 +65,7 @@ static size_t copy_from_user_mvcos(size_t size, const void __user *ptr, void *x) return size; } -static size_t copy_to_user_mvcos(size_t size, void __user *ptr, const void *x) +static size_t copy_to_user_mvcos(void __user *ptr, const void *x, size_t size) { register unsigned long reg0 asm("0") = 0x810000UL; unsigned long tmp1, tmp2; @@ -94,8 +94,8 @@ static size_t copy_to_user_mvcos(size_t size, void __user *ptr, const void *x) return size; } -static size_t copy_in_user_mvcos(size_t size, void __user *to, - const void __user *from) +static size_t copy_in_user_mvcos(void __user *to, const void __user *from, + size_t size) { register unsigned long reg0 asm("0") = 0x810081UL; unsigned long tmp1, tmp2; @@ -117,7 +117,7 @@ static size_t copy_in_user_mvcos(size_t size, void __user *to, return size; } -static size_t clear_user_mvcos(size_t size, void __user *to) +static size_t clear_user_mvcos(void __user *to, size_t size) { register unsigned long reg0 asm("0") = 0x810000UL; unsigned long tmp1, tmp2; @@ -145,7 +145,7 @@ static size_t clear_user_mvcos(size_t size, void __user *to) return size; } -static size_t strnlen_user_mvcos(size_t count, const char __user *src) +static size_t strnlen_user_mvcos(const char __user *src, size_t count) { size_t done, len, offset, len_str; char buf[256]; @@ -155,7 +155,7 @@ static size_t strnlen_user_mvcos(size_t count, const char __user *src) offset = (size_t)src & ~PAGE_MASK; len = min(256UL, PAGE_SIZE - offset); len = min(count - done, len); - if (copy_from_user_mvcos(len, src, buf)) + if (copy_from_user_mvcos(buf, src, len)) return 0; len_str = strnlen(buf, len); done += len_str; @@ -164,8 +164,8 @@ static size_t strnlen_user_mvcos(size_t count, const char __user *src) return done + 1; } -static size_t strncpy_from_user_mvcos(size_t count, const char __user *src, - char *dst) +static size_t strncpy_from_user_mvcos(char *dst, const char __user *src, + size_t count) { size_t done, len, offset, len_str; @@ -175,7 +175,7 @@ static size_t strncpy_from_user_mvcos(size_t count, const char __user *src, do { offset = (size_t)src & ~PAGE_MASK; len = min(count - done, PAGE_SIZE - offset); - if (copy_from_user_mvcos(len, src, dst)) + if (copy_from_user_mvcos(dst, src, len)) return -EFAULT; len_str = strnlen(dst, len); done += len_str; diff --git a/arch/s390/lib/uaccess_pt.c b/arch/s390/lib/uaccess_pt.c index 61ebcc9ccb34..2fa696b39b56 100644 --- a/arch/s390/lib/uaccess_pt.c +++ b/arch/s390/lib/uaccess_pt.c @@ -22,7 +22,7 @@ #define SLR "slgr" #endif -static size_t strnlen_kernel(size_t count, const char __user *src) +static size_t strnlen_kernel(const char __user *src, size_t count) { register unsigned long reg0 asm("0") = 0UL; unsigned long tmp1, tmp2; @@ -42,8 +42,8 @@ static size_t strnlen_kernel(size_t count, const char __user *src) return count; } -static size_t copy_in_kernel(size_t count, void __user *to, - const void __user *from) +static size_t copy_in_kernel(void __user *to, const void __user *from, + size_t count) { unsigned long tmp1; @@ -211,26 +211,26 @@ fault: return 0; } -static size_t copy_from_user_pt(size_t n, const void __user *from, void *to) +static size_t copy_from_user_pt(void *to, const void __user *from, size_t n) { size_t rc; if (segment_eq(get_fs(), KERNEL_DS)) - return copy_in_kernel(n, (void __user *) to, from); + return copy_in_kernel((void __user *) to, from, n); rc = __user_copy_pt((unsigned long) from, to, n, 0); if (unlikely(rc)) memset(to + n - rc, 0, rc); return rc; } -static size_t copy_to_user_pt(size_t n, void __user *to, const void *from) +static size_t copy_to_user_pt(void __user *to, const void *from, size_t n) { if (segment_eq(get_fs(), KERNEL_DS)) - return copy_in_kernel(n, to, (void __user *) from); + return copy_in_kernel(to, (void __user *) from, n); return __user_copy_pt((unsigned long) to, (void *) from, n, 1); } -static size_t clear_user_pt(size_t n, void __user *to) +static size_t clear_user_pt(void __user *to, size_t n) { void *zpage = (void *) empty_zero_page; long done, size, ret; @@ -242,7 +242,7 @@ static size_t clear_user_pt(size_t n, void __user *to) else size = n - done; if (segment_eq(get_fs(), KERNEL_DS)) - ret = copy_in_kernel(n, to, (void __user *) zpage); + ret = copy_in_kernel(to, (void __user *) zpage, n); else ret = __user_copy_pt((unsigned long) to, zpage, size, 1); done += size; @@ -253,7 +253,7 @@ static size_t clear_user_pt(size_t n, void __user *to) return 0; } -static size_t strnlen_user_pt(size_t count, const char __user *src) +static size_t strnlen_user_pt(const char __user *src, size_t count) { unsigned long uaddr = (unsigned long) src; struct mm_struct *mm = current->mm; @@ -263,7 +263,7 @@ static size_t strnlen_user_pt(size_t count, const char __user *src) if (unlikely(!count)) return 0; if (segment_eq(get_fs(), KERNEL_DS)) - return strnlen_kernel(count, src); + return strnlen_kernel(src, count); if (!mm) return 0; done = 0; @@ -289,8 +289,8 @@ fault: goto retry; } -static size_t strncpy_from_user_pt(size_t count, const char __user *src, - char *dst) +static size_t strncpy_from_user_pt(char *dst, const char __user *src, + size_t count) { size_t done, len, offset, len_str; @@ -301,7 +301,7 @@ static size_t strncpy_from_user_pt(size_t count, const char __user *src, offset = (size_t)src & ~PAGE_MASK; len = min(count - done, PAGE_SIZE - offset); if (segment_eq(get_fs(), KERNEL_DS)) { - if (copy_in_kernel(len, (void __user *) dst, src)) + if (copy_in_kernel((void __user *) dst, src, len)) return -EFAULT; } else { if (__user_copy_pt((unsigned long) src, dst, len, 0)) @@ -315,8 +315,8 @@ static size_t strncpy_from_user_pt(size_t count, const char __user *src, return done; } -static size_t copy_in_user_pt(size_t n, void __user *to, - const void __user *from) +static size_t copy_in_user_pt(void __user *to, const void __user *from, + size_t n) { struct mm_struct *mm = current->mm; unsigned long offset_max, uaddr, done, size, error_code; @@ -326,7 +326,7 @@ static size_t copy_in_user_pt(size_t n, void __user *to, int write_user; if (segment_eq(get_fs(), KERNEL_DS)) - return copy_in_kernel(n, to, from); + return copy_in_kernel(to, from, n); if (!mm) return n; done = 0; -- cgit v1.2.3