Commit 76666be8 authored by Al Viro's avatar Al Viro

sparc: switch to providing csum_and_copy_from_user()

sparc64 already is equivalent to that (trivial access_ok());
add it into sparc32 csum_partial_copy_from_user() and we can
rename both to csum_and_copy_fromUser() and be done with that.
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 77a8710b
/* SPDX-License-Identifier: GPL-2.0 */ /* SPDX-License-Identifier: GPL-2.0 */
#ifndef ___ASM_SPARC_CHECKSUM_H #ifndef ___ASM_SPARC_CHECKSUM_H
#define ___ASM_SPARC_CHECKSUM_H #define ___ASM_SPARC_CHECKSUM_H
#define _HAVE_ARCH_COPY_AND_CSUM_FROM_USER
#if defined(__sparc__) && defined(__arch64__) #if defined(__sparc__) && defined(__arch64__)
#include <asm/checksum_64.h> #include <asm/checksum_64.h>
#else #else
......
...@@ -60,7 +60,7 @@ csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum) ...@@ -60,7 +60,7 @@ csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum)
} }
static inline __wsum static inline __wsum
csum_partial_copy_from_user(const void __user *src, void *dst, int len, csum_and_copy_from_user(const void __user *src, void *dst, int len,
__wsum sum, int *err) __wsum sum, int *err)
{ {
register unsigned long ret asm("o0") = (unsigned long)src; register unsigned long ret asm("o0") = (unsigned long)src;
...@@ -68,6 +68,12 @@ csum_partial_copy_from_user(const void __user *src, void *dst, int len, ...@@ -68,6 +68,12 @@ csum_partial_copy_from_user(const void __user *src, void *dst, int len,
register int l asm("g1") = len; register int l asm("g1") = len;
register __wsum s asm("g7") = sum; register __wsum s asm("g7") = sum;
if (unlikely(!access_ok(src, len))) {
if (len)
*err = -EFAULT;
return sum;
}
__asm__ __volatile__ ( __asm__ __volatile__ (
".section __ex_table,#alloc\n\t" ".section __ex_table,#alloc\n\t"
".align 4\n\t" ".align 4\n\t"
......
...@@ -46,7 +46,7 @@ long __csum_partial_copy_from_user(const void __user *src, ...@@ -46,7 +46,7 @@ long __csum_partial_copy_from_user(const void __user *src,
__wsum sum); __wsum sum);
static inline __wsum static inline __wsum
csum_partial_copy_from_user(const void __user *src, csum_and_copy_from_user(const void __user *src,
void *dst, int len, void *dst, int len,
__wsum sum, int *err) __wsum sum, int *err)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment