[PATCH 2/2] LoongArch: Adjust the user_regset_copyin parameter to the correct offset

From: Qing Zhang
Date: Tue Apr 18 2023 - 05:14:15 EST


Ensure that user_watch_state can be set correctly by the user.

Signed-off-by: Qing Zhang <zhangqing@xxxxxxxxxxx>
---
arch/loongarch/kernel/ptrace.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/loongarch/kernel/ptrace.c b/arch/loongarch/kernel/ptrace.c
index 9c3bc1bbf2ff..f5bd7b1430ae 100644
--- a/arch/loongarch/kernel/ptrace.c
+++ b/arch/loongarch/kernel/ptrace.c
@@ -687,7 +687,7 @@ static int hw_break_set(struct task_struct *target,
break;

ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &mask,
- offset, offset + PTRACE_HBP_ADDR_SZ);
+ offset, offset + PTRACE_HBP_MASK_SZ);
if (ret)
return ret;

@@ -696,8 +696,8 @@ static int hw_break_set(struct task_struct *target,
return ret;
offset += PTRACE_HBP_MASK_SZ;

- ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &mask,
- offset, offset + PTRACE_HBP_MASK_SZ);
+ ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &ctrl,
+ offset, offset + PTRACE_HBP_CTRL_SZ);
if (ret)
return ret;

--
2.20.1