-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
asm-generic/uaccess.h: don't mess with __copy_{to,from}_user
only h8300 actually used those; might as well define them there. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
- Loading branch information
Al Viro
committed
Mar 28, 2017
1 parent
db68ce1
commit 3fb5007
Showing
6 changed files
with
52 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#ifndef _ASM_UACCESS_H | ||
#define _ASM_UACCESS_H | ||
|
||
#include <linux/string.h> | ||
|
||
static inline __must_check long __copy_from_user(void *to, | ||
const void __user * from, unsigned long n) | ||
{ | ||
if (__builtin_constant_p(n)) { | ||
switch(n) { | ||
case 1: | ||
*(u8 *)to = *(u8 __force *)from; | ||
return 0; | ||
case 2: | ||
*(u16 *)to = *(u16 __force *)from; | ||
return 0; | ||
case 4: | ||
*(u32 *)to = *(u32 __force *)from; | ||
return 0; | ||
} | ||
} | ||
|
||
memcpy(to, (const void __force *)from, n); | ||
return 0; | ||
} | ||
|
||
static inline __must_check long __copy_to_user(void __user *to, | ||
const void *from, unsigned long n) | ||
{ | ||
if (__builtin_constant_p(n)) { | ||
switch(n) { | ||
case 1: | ||
*(u8 __force *)to = *(u8 *)from; | ||
return 0; | ||
case 2: | ||
*(u16 __force *)to = *(u16 *)from; | ||
return 0; | ||
case 4: | ||
*(u32 __force *)to = *(u32 *)from; | ||
return 0; | ||
default: | ||
break; | ||
} | ||
} | ||
|
||
memcpy((void __force *)to, from, n); | ||
return 0; | ||
} | ||
|
||
#include <asm-generic/uaccess.h> | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters