1 /* SPDX-License-Identifier: GPL-2.0 */
5 #include <linux/string.h>
7 static inline __must_check
unsigned long
8 raw_copy_from_user(void *to
, const void __user
* from
, unsigned long n
)
10 if (__builtin_constant_p(n
)) {
13 *(u8
*)to
= *(u8 __force
*)from
;
16 *(u16
*)to
= *(u16 __force
*)from
;
19 *(u32
*)to
= *(u32 __force
*)from
;
24 memcpy(to
, (const void __force
*)from
, n
);
28 static inline __must_check
unsigned long
29 raw_copy_to_user(void __user
*to
, const void *from
, unsigned long n
)
31 if (__builtin_constant_p(n
)) {
34 *(u8 __force
*)to
= *(u8
*)from
;
37 *(u16 __force
*)to
= *(u16
*)from
;
40 *(u32 __force
*)to
= *(u32
*)from
;
47 memcpy((void __force
*)to
, from
, n
);
50 #define INLINE_COPY_FROM_USER
51 #define INLINE_COPY_TO_USER
53 #include <asm-generic/uaccess.h>