提交 b857bd29 编写于 作者: D David S. Miller

sparc: Fix regset register window handling.

We have to adjust 'reg_window' down by 16 becuase the 'pos' iterator
we'll use to index into the stack slots will be between 16 and 32.
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 c4a3987f
...@@ -65,6 +65,7 @@ static int genregs32_get(struct task_struct *target, ...@@ -65,6 +65,7 @@ static int genregs32_get(struct task_struct *target,
*k++ = regs->u_regs[pos++]; *k++ = regs->u_regs[pos++];
reg_window = (unsigned long __user *) regs->u_regs[UREG_I6]; reg_window = (unsigned long __user *) regs->u_regs[UREG_I6];
reg_window -= 16;
for (; count > 0 && pos < 32; count--) { for (; count > 0 && pos < 32; count--) {
if (get_user(*k++, &reg_window[pos++])) if (get_user(*k++, &reg_window[pos++]))
return -EFAULT; return -EFAULT;
...@@ -76,6 +77,7 @@ static int genregs32_get(struct task_struct *target, ...@@ -76,6 +77,7 @@ static int genregs32_get(struct task_struct *target,
} }
reg_window = (unsigned long __user *) regs->u_regs[UREG_I6]; reg_window = (unsigned long __user *) regs->u_regs[UREG_I6];
reg_window -= 16;
for (; count > 0 && pos < 32; count--) { for (; count > 0 && pos < 32; count--) {
if (get_user(reg, &reg_window[pos++]) || if (get_user(reg, &reg_window[pos++]) ||
put_user(reg, u++)) put_user(reg, u++))
...@@ -141,6 +143,7 @@ static int genregs32_set(struct task_struct *target, ...@@ -141,6 +143,7 @@ static int genregs32_set(struct task_struct *target,
regs->u_regs[pos++] = *k++; regs->u_regs[pos++] = *k++;
reg_window = (unsigned long __user *) regs->u_regs[UREG_I6]; reg_window = (unsigned long __user *) regs->u_regs[UREG_I6];
reg_window -= 16;
for (; count > 0 && pos < 32; count--) { for (; count > 0 && pos < 32; count--) {
if (put_user(*k++, &reg_window[pos++])) if (put_user(*k++, &reg_window[pos++]))
return -EFAULT; return -EFAULT;
...@@ -153,6 +156,7 @@ static int genregs32_set(struct task_struct *target, ...@@ -153,6 +156,7 @@ static int genregs32_set(struct task_struct *target,
} }
reg_window = (unsigned long __user *) regs->u_regs[UREG_I6]; reg_window = (unsigned long __user *) regs->u_regs[UREG_I6];
reg_window -= 16;
for (; count > 0 && pos < 32; count--) { for (; count > 0 && pos < 32; count--) {
if (get_user(reg, u++) || if (get_user(reg, u++) ||
put_user(reg, &reg_window[pos++])) put_user(reg, &reg_window[pos++]))
......
...@@ -492,6 +492,7 @@ static int genregs32_get(struct task_struct *target, ...@@ -492,6 +492,7 @@ static int genregs32_get(struct task_struct *target,
*k++ = regs->u_regs[pos++]; *k++ = regs->u_regs[pos++];
reg_window = (compat_ulong_t __user *) regs->u_regs[UREG_I6]; reg_window = (compat_ulong_t __user *) regs->u_regs[UREG_I6];
reg_window -= 16;
if (target == current) { if (target == current) {
for (; count > 0 && pos < 32; count--) { for (; count > 0 && pos < 32; count--) {
if (get_user(*k++, &reg_window[pos++])) if (get_user(*k++, &reg_window[pos++]))
...@@ -516,6 +517,7 @@ static int genregs32_get(struct task_struct *target, ...@@ -516,6 +517,7 @@ static int genregs32_get(struct task_struct *target,
} }
reg_window = (compat_ulong_t __user *) regs->u_regs[UREG_I6]; reg_window = (compat_ulong_t __user *) regs->u_regs[UREG_I6];
reg_window -= 16;
if (target == current) { if (target == current) {
for (; count > 0 && pos < 32; count--) { for (; count > 0 && pos < 32; count--) {
if (get_user(reg, &reg_window[pos++]) || if (get_user(reg, &reg_window[pos++]) ||
...@@ -599,6 +601,7 @@ static int genregs32_set(struct task_struct *target, ...@@ -599,6 +601,7 @@ static int genregs32_set(struct task_struct *target,
regs->u_regs[pos++] = *k++; regs->u_regs[pos++] = *k++;
reg_window = (compat_ulong_t __user *) regs->u_regs[UREG_I6]; reg_window = (compat_ulong_t __user *) regs->u_regs[UREG_I6];
reg_window -= 16;
if (target == current) { if (target == current) {
for (; count > 0 && pos < 32; count--) { for (; count > 0 && pos < 32; count--) {
if (put_user(*k++, &reg_window[pos++])) if (put_user(*k++, &reg_window[pos++]))
...@@ -625,6 +628,7 @@ static int genregs32_set(struct task_struct *target, ...@@ -625,6 +628,7 @@ static int genregs32_set(struct task_struct *target,
} }
reg_window = (compat_ulong_t __user *) regs->u_regs[UREG_I6]; reg_window = (compat_ulong_t __user *) regs->u_regs[UREG_I6];
reg_window -= 16;
if (target == current) { if (target == current) {
for (; count > 0 && pos < 32; count--) { for (; count > 0 && pos < 32; count--) {
if (get_user(reg, u++) || if (get_user(reg, u++) ||
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册