Skip to content

Commit

Permalink
mips: propagate the calling convention change down into __csum_partia…
Browse files Browse the repository at this point in the history
…l_copy_..._user()

and turn the exception handlers into simply returning 0, which
simplifies the hell out of things in csum_partial.S

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Aug 20, 2020
1 parent f863c65 commit 1cd95ab
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 195 deletions.
26 changes: 6 additions & 20 deletions arch/mips/include/asm/checksum.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,17 @@
*/
__wsum csum_partial(const void *buff, int len, __wsum sum);

__wsum __csum_partial_copy_from_user(const void *src, void *dst,
int len, __wsum sum, int *err_ptr);
__wsum __csum_partial_copy_to_user(const void *src, void *dst,
int len, __wsum sum, int *err_ptr);
__wsum __csum_partial_copy_from_user(const void __user *src, void *dst, int len);
__wsum __csum_partial_copy_to_user(const void *src, void __user *dst, int len);

#define _HAVE_ARCH_COPY_AND_CSUM_FROM_USER
static inline
__wsum csum_and_copy_from_user(const void __user *src, void *dst, int len)
{
__wsum sum = ~0U;
int err = 0;

might_fault();

if (!access_ok(src, len))
return 0;
sum = __csum_partial_copy_from_user((__force void *)src, dst,
len, sum, &err);
return err ? 0 : sum;
return __csum_partial_copy_from_user(src, dst, len);
}

/*
Expand All @@ -62,27 +54,21 @@ __wsum csum_and_copy_from_user(const void __user *src, void *dst, int len)
static inline
__wsum csum_and_copy_to_user(const void *src, void __user *dst, int len)
{
int err = 0;
__wsum sum = ~0U;

might_fault();
if (!access_ok(dst, len))
return 0;
sum = __csum_partial_copy_to_user(src,
(__force void *)dst,
len, sum, &err);
return err ? 0 : sum;
return __csum_partial_copy_to_user(src, dst, len);
}

/*
* the same as csum_partial, but copies from user space (but on MIPS
* we have just one address space, so this is identical to the above)
*/
#define _HAVE_ARCH_CSUM_AND_COPY
__wsum __csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum);
__wsum __csum_partial_copy_nocheck(const void *src, void *dst, int len);
static inline __wsum csum_partial_copy_nocheck(const void *src, void *dst, int len)
{
return __csum_partial_copy_nocheck(src, dst, len, 0);
return __csum_partial_copy_nocheck(src, dst, len);
}

/*
Expand Down
Loading

0 comments on commit 1cd95ab

Please sign in to comment.