summaryrefslogtreecommitdiffstats
path: root/arch/sparc/lib/usercopy.c
Commit message (Collapse)AuthorAgeFilesLines
* lib: Sparc's strncpy_from_user is generic enough, move under lib/David S. Miller2012-05-241-144/+0Star
| | | | | | | | | | | | | | To use this, an architecture simply needs to: 1) Provide a user_addr_max() implementation via asm/uaccess.h 2) Add "select GENERIC_STRNCPY_FROM_USER" to their arch Kcnfig 3) Remove the existing strncpy_from_user() implementation and symbol exports their architecture had. Signed-off-by: David S. Miller <davem@davemloft.net> Acked-by: David Howells <dhowells@redhat.com>
* kernel: Move REPEAT_BYTE definition into linux/kernel.hDavid S. Miller2012-05-241-2/+1Star
| | | | | | | And make sure that everything using it explicitly includes that header file. Signed-off-by: David S. Miller <davem@davemloft.net>
* sparc: Increase portability of strncpy_from_user() implementation.David S. Miller2012-05-241-5/+27
| | | | | | | | | | | | | | Hide details of maximum user address calculation in a new asm/uaccess.h interface named user_addr_max(). Provide little-endian implementation in find_zero(), which should work but can probably be improved. Abstrace alignment check behind IS_UNALIGNED() macro. Kill double-semicolon, noticed by David Howells. Signed-off-by: David S. Miller <davem@davemloft.net>
* sparc: Optimize strncpy_from_user() zero byte search.David S. Miller2012-05-241-29/+21Star
| | | | | | | | | | | | | | | Compute a mask that will only have 0x80 in the bytes which had a zero in them. The formula is: ~(((x & 0x7f7f7f7f) + 0x7f7f7f7f) | x | 0x7f7f7f7f) In the inner word iteration, we have to compute the "x | 0x7f7f7f7f" part, so we can reuse that in the above calculation. Once we have this mask, we perform divide and conquer to find the highest 0x80 location. Signed-off-by: David S. Miller <davem@davemloft.net>
* sparc: Add full proper error handling to strncpy_from_user().David S. Miller2012-05-231-0/+132
| | | | | | | | | | | | Linus removed the end-of-address-space hackery from fs/namei.c:do_getname() so we really have to validate these edge conditions and cannot cheat any more (as x86 used to as well). Move to a common C implementation like x86 did. And if both src and dst are sufficiently aligned we'll do word at a time copies and checks as well. Signed-off-by: David S. Miller <davem@davemloft.net>
* sparc: Use __builtin_object_size() to validate the buffer size for ↵David S. Miller2009-12-111-0/+8
copy_from_user() This mirrors x86 commit 9f0cf4adb6aa0bfccf675c938124e68f7f06349d (x86: Use __builtin_object_size() to validate the buffer size for copy_from_user()) Signed-off-by: David S. Miller <davem@davemloft.net>