Skip to content

Commit c331652

Browse files
Christoph HellwigAl Viro
authored andcommitted
powerpc: use non-set_fs based maccess routines
Provide __get_kernel_nofault and __put_kernel_nofault routines to implement the maccess routines without messing with set_fs and without opening up access to user space. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 47058bb commit c331652

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

arch/powerpc/include/asm/uaccess.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,4 +623,20 @@ do { \
623623
__put_user_goto(*(u8*)(_src + _i), (u8 __user *)(_dst + _i), e);\
624624
} while (0)
625625

626+
#define HAVE_GET_KERNEL_NOFAULT
627+
628+
#define __get_kernel_nofault(dst, src, type, err_label) \
629+
do { \
630+
int __kr_err; \
631+
\
632+
__get_user_size_allowed(*((type *)(dst)), (__force type __user *)(src),\
633+
sizeof(type), __kr_err); \
634+
if (unlikely(__kr_err)) \
635+
goto err_label; \
636+
} while (0)
637+
638+
#define __put_kernel_nofault(dst, src, type, err_label) \
639+
__put_user_size_goto(*((type *)(src)), \
640+
(__force type __user *)(dst), sizeof(type), err_label)
641+
626642
#endif /* _ARCH_POWERPC_UACCESS_H */

0 commit comments

Comments
 (0)