From 5904122c46581a5ccee54a51ef07e0d891fd7aef Mon Sep 17 00:00:00 2001 From: Al Viro Date: Tue, 18 Feb 2020 14:26:32 -0500 Subject: take the dummy csum_and_copy_from_user() into net/checksum.h now that can be done conveniently - all non-trivial cases have _HAVE_ARCH_COPY_AND_CSUM_FROM_USER defined, so the fallback in net/checksum.h is used only for dummy (copy_from_user, then csum_partial) implementation. Allowing us to get rid of all dummy instances, both of csum_and_copy_from_user() and csum_partial_copy_from_user(). Signed-off-by: Al Viro --- include/net/checksum.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'include/net') diff --git a/include/net/checksum.h b/include/net/checksum.h index 97bf4885a962..5f9c73c0eeb9 100644 --- a/include/net/checksum.h +++ b/include/net/checksum.h @@ -26,13 +26,9 @@ static inline __wsum csum_and_copy_from_user (const void __user *src, void *dst, int len, __wsum sum, int *err_ptr) { - if (access_ok(src, len)) - return csum_partial_copy_from_user(src, dst, len, sum, err_ptr); - - if (len) + if (copy_from_user(dst, src, len)) *err_ptr = -EFAULT; - - return sum; + return csum_partial(dst, len, sum); } #endif -- cgit v1.2.3 From 001c1a655f0a4e4ebe5d9beb47466dc5c6ab4871 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Sat, 25 Apr 2020 18:01:30 -0400 Subject: default csum_and_copy_to_user(): don't bother with access_ok() Signed-off-by: Al Viro --- include/net/checksum.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'include/net') diff --git a/include/net/checksum.h b/include/net/checksum.h index 5f9c73c0eeb9..46754ba9d7b7 100644 --- a/include/net/checksum.h +++ b/include/net/checksum.h @@ -38,10 +38,8 @@ static __inline__ __wsum csum_and_copy_to_user { sum = csum_partial(src, len, sum); - if (access_ok(dst, len)) { - if (copy_to_user(dst, src, len) == 0) - return sum; - } + if (copy_to_user(dst, src, len) == 0) + return sum; if (len) *err_ptr = -EFAULT; -- cgit v1.2.3