Skip to content

Commit

Permalink
sparc: switch to providing csum_and_copy_from_user()
Browse files Browse the repository at this point in the history
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: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed May 29, 2020
1 parent 77a8710 commit 76666be
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions arch/sparc/include/asm/checksum.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef ___ASM_SPARC_CHECKSUM_H
#define ___ASM_SPARC_CHECKSUM_H
#define _HAVE_ARCH_COPY_AND_CSUM_FROM_USER
#if defined(__sparc__) && defined(__arch64__)
#include <asm/checksum_64.h>
#else
Expand Down
8 changes: 7 additions & 1 deletion arch/sparc/include/asm/checksum_32.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,20 @@ csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum)
}

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)
{
register unsigned long ret asm("o0") = (unsigned long)src;
register char *d asm("o1") = dst;
register int l asm("g1") = len;
register __wsum s asm("g7") = sum;

if (unlikely(!access_ok(src, len))) {
if (len)
*err = -EFAULT;
return sum;
}

__asm__ __volatile__ (
".section __ex_table,#alloc\n\t"
".align 4\n\t"
Expand Down
2 changes: 1 addition & 1 deletion arch/sparc/include/asm/checksum_64.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ long __csum_partial_copy_from_user(const void __user *src,
__wsum sum);

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,
__wsum sum, int *err)
{
Expand Down

0 comments on commit 76666be

Please sign in to comment.