summaryrefslogtreecommitdiffstats
path: root/arch/um/kernel/tt/uaccess_user.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um/kernel/tt/uaccess_user.c')
-rw-r--r--arch/um/kernel/tt/uaccess_user.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/arch/um/kernel/tt/uaccess_user.c b/arch/um/kernel/tt/uaccess_user.c
index f01475512ec..6c92bbccb49 100644
--- a/arch/um/kernel/tt/uaccess_user.c
+++ b/arch/um/kernel/tt/uaccess_user.c
@@ -10,6 +10,7 @@
#include "uml_uaccess.h"
#include "task.h"
#include "kern_util.h"
+#include "os.h"
int __do_copy_from_user(void *to, const void *from, int n,
void **fault_addr, void **fault_catcher)
@@ -22,8 +23,15 @@ int __do_copy_from_user(void *to, const void *from, int n,
__do_copy, &faulted);
TASK_REGS(get_current())->tt = save;
- if(!faulted) return(0);
- else return(n - (fault - (unsigned long) from));
+ if(!faulted)
+ return 0;
+ else if (fault)
+ return n - (fault - (unsigned long) from);
+ else
+ /* In case of a general protection fault, we don't have the
+ * fault address, so NULL is used instead. Pretend we didn't
+ * copy anything. */
+ return n;
}
static void __do_strncpy(void *dst, const void *src, int count)