Commit c281a6c1 authored by Al Viro's avatar Al Viro

x86: switch 32bit csum_and_copy_to_user() to user_access_{begin,end}()

consolidate HAVE_CSUM_COPY_USER for 32bit and 64bit, while are at it
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 0a5ea224
/* SPDX-License-Identifier: GPL-2.0 */ /* SPDX-License-Identifier: GPL-2.0 */
#define _HAVE_ARCH_COPY_AND_CSUM_FROM_USER 1 #define _HAVE_ARCH_COPY_AND_CSUM_FROM_USER 1
#define HAVE_CSUM_COPY_USER
#ifdef CONFIG_X86_32 #ifdef CONFIG_X86_32
# include <asm/checksum_32.h> # include <asm/checksum_32.h>
#else #else
......
...@@ -176,7 +176,6 @@ static inline __sum16 csum_ipv6_magic(const struct in6_addr *saddr, ...@@ -176,7 +176,6 @@ static inline __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
/* /*
* Copy and checksum to user * Copy and checksum to user
*/ */
#define HAVE_CSUM_COPY_USER
static inline __wsum csum_and_copy_to_user(const void *src, static inline __wsum csum_and_copy_to_user(const void *src,
void __user *dst, void __user *dst,
int len, __wsum sum, int len, __wsum sum,
...@@ -185,11 +184,10 @@ static inline __wsum csum_and_copy_to_user(const void *src, ...@@ -185,11 +184,10 @@ static inline __wsum csum_and_copy_to_user(const void *src,
__wsum ret; __wsum ret;
might_sleep(); might_sleep();
if (access_ok(dst, len)) { if (user_access_begin(dst, len)) {
stac();
ret = csum_partial_copy_generic(src, (__force void *)dst, ret = csum_partial_copy_generic(src, (__force void *)dst,
len, sum, NULL, err_ptr); len, sum, NULL, err_ptr);
clac(); user_access_end();
return ret; return ret;
} }
......
...@@ -129,9 +129,6 @@ static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, ...@@ -129,9 +129,6 @@ static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
*/ */
extern __wsum csum_partial(const void *buff, int len, __wsum sum); extern __wsum csum_partial(const void *buff, int len, __wsum sum);
#define HAVE_CSUM_COPY_USER 1
/* Do not call this directly. Use the wrappers below */ /* Do not call this directly. Use the wrappers below */
extern __visible __wsum csum_partial_copy_generic(const void *src, const void *dst, extern __visible __wsum csum_partial_copy_generic(const void *src, const void *dst,
int len, __wsum sum, int len, __wsum sum,
......
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