hc
2024-05-10 37f49e37ab4cb5d0bc4c60eb5c6d4dd57db767bb
kernel/arch/sh/include/asm/checksum_32.h
....@@ -1,11 +1,8 @@
1
+/* SPDX-License-Identifier: GPL-2.0 */
12 #ifndef __ASM_SH_CHECKSUM_H
23 #define __ASM_SH_CHECKSUM_H
34
45 /*
5
- * This file is subject to the terms and conditions of the GNU General Public
6
- * License. See the file "COPYING" in the main directory of this archive
7
- * for more details.
8
- *
96 * Copyright (C) 1999 by Kaz Kojima & Niibe Yutaka
107 */
118
....@@ -33,10 +30,9 @@
3330 * better 64-bit) boundary
3431 */
3532
36
-asmlinkage __wsum csum_partial_copy_generic(const void *src, void *dst,
37
- int len, __wsum sum,
38
- int *src_err_ptr, int *dst_err_ptr);
33
+asmlinkage __wsum csum_partial_copy_generic(const void *src, void *dst, int len);
3934
35
+#define _HAVE_ARCH_CSUM_AND_COPY
4036 /*
4137 * Note: when you get a NULL pointer exception here this means someone
4238 * passed in an incorrect kernel address to one of these functions.
....@@ -45,18 +41,18 @@
4541 * access_ok().
4642 */
4743 static inline
48
-__wsum csum_partial_copy_nocheck(const void *src, void *dst,
49
- int len, __wsum sum)
44
+__wsum csum_partial_copy_nocheck(const void *src, void *dst, int len)
5045 {
51
- return csum_partial_copy_generic(src, dst, len, sum, NULL, NULL);
46
+ return csum_partial_copy_generic(src, dst, len);
5247 }
5348
49
+#define _HAVE_ARCH_COPY_AND_CSUM_FROM_USER
5450 static inline
55
-__wsum csum_partial_copy_from_user(const void __user *src, void *dst,
56
- int len, __wsum sum, int *err_ptr)
51
+__wsum csum_and_copy_from_user(const void __user *src, void *dst, int len)
5752 {
58
- return csum_partial_copy_generic((__force const void *)src, dst,
59
- len, sum, err_ptr, NULL);
53
+ if (!access_ok(src, len))
54
+ return 0;
55
+ return csum_partial_copy_generic((__force const void *)src, dst, len);
6056 }
6157
6258 /*
....@@ -197,16 +193,10 @@
197193 #define HAVE_CSUM_COPY_USER
198194 static inline __wsum csum_and_copy_to_user(const void *src,
199195 void __user *dst,
200
- int len, __wsum sum,
201
- int *err_ptr)
196
+ int len)
202197 {
203
- if (access_ok(VERIFY_WRITE, dst, len))
204
- return csum_partial_copy_generic((__force const void *)src,
205
- dst, len, sum, NULL, err_ptr);
206
-
207
- if (len)
208
- *err_ptr = -EFAULT;
209
-
210
- return (__force __wsum)-1; /* invalid checksum */
198
+ if (!access_ok(dst, len))
199
+ return 0;
200
+ return csum_partial_copy_generic((__force const void *)src, dst, len);
211201 }
212202 #endif /* __ASM_SH_CHECKSUM_H */