mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-27 01:40:56 +07:00
arm64: ptrace: fix compat reg getter/setter return values
copy_{to,from}_user return the number of bytes remaining on failure, not an error code. This patch returns -EFAULT when the copy operation didn't complete, rather than expose the number of bytes not copied directly to userspace. Signed-off-by: Will Deacon <will.deacon@arm.com>
This commit is contained in:
parent
27d7ff273c
commit
85487edd25
@ -663,8 +663,10 @@ static int compat_gpr_get(struct task_struct *target,
|
||||
kbuf += sizeof(reg);
|
||||
} else {
|
||||
ret = copy_to_user(ubuf, ®, sizeof(reg));
|
||||
if (ret)
|
||||
if (ret) {
|
||||
ret = -EFAULT;
|
||||
break;
|
||||
}
|
||||
|
||||
ubuf += sizeof(reg);
|
||||
}
|
||||
@ -702,8 +704,10 @@ static int compat_gpr_set(struct task_struct *target,
|
||||
kbuf += sizeof(reg);
|
||||
} else {
|
||||
ret = copy_from_user(®, ubuf, sizeof(reg));
|
||||
if (ret)
|
||||
return ret;
|
||||
if (ret) {
|
||||
ret = -EFAULT;
|
||||
break;
|
||||
}
|
||||
|
||||
ubuf += sizeof(reg);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user