1 /* user_fixup.c: Fix up user copy faults.
3 * Copyright (C) 2004 David S. Miller <davem@redhat.com>
6 #include <linux/compiler.h>
7 #include <linux/kernel.h>
8 #include <linux/string.h>
9 #include <linux/errno.h>
10 #include <asm/uaccess.h>
12 /* Calculating the exact fault address when using
13 * block loads and stores can be very complicated.
14 * Instead of trying to be clever and handling all
15 * of the cases, just fix things up simply here.
18 unsigned long copy_from_user_fixup(void *to
, const void __user
*from
, unsigned long size
)
21 const char __user
*src
= from
;
24 if (__get_user(*dst
, src
))
37 unsigned long copy_to_user_fixup(void __user
*to
, const void *from
, unsigned long size
)
39 char __user
*dst
= to
;
40 const char *src
= from
;
43 if (__put_user(*src
, dst
))
53 unsigned long copy_in_user_fixup(void __user
*to
, void __user
*from
, unsigned long size
)
55 char __user
*dst
= to
;
56 char __user
*src
= from
;
61 if (__get_user(tmp
, src
))
63 if (__put_user(tmp
, dst
))