summaryrefslogtreecommitdiff
path: root/linux-user
diff options
context:
space:
mode:
Diffstat (limited to 'linux-user')
-rw-r--r--linux-user/syscall.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 2bba500187..cec8428589 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -11194,11 +11194,16 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
case TARGET_NR_mincore:
{
void *a;
+ ret = -TARGET_ENOMEM;
+ a = lock_user(VERIFY_READ, arg1, arg2, 0);
+ if (!a) {
+ goto fail;
+ }
ret = -TARGET_EFAULT;
- if (!(a = lock_user(VERIFY_READ, arg1,arg2, 0)))
- goto efault;
- if (!(p = lock_user_string(arg3)))
+ p = lock_user_string(arg3);
+ if (!p) {
goto mincore_fail;
+ }
ret = get_errno(mincore(a, arg2, p));
unlock_user(p, arg3, ret);
mincore_fail: