Message ID | 30738.1321497066@neuling.org (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
On Thu, 2011-11-17 at 13:31 +1100, Michael Neuling wrote: > From: Benjamin Herrenschmidt <benh@kernel.crashing.org> > > powerpc/ptrace: Fix build with gcc 4.6 > > gcc (rightfully) complains that we are accessing beyond the > end of the fpr array (we do, to access the fpscr). This patch is still missing from the 3.0 stable series. Do we need to resend ? cheers
Michael Ellerman <michael@ellerman.id.au> wrote: >On Thu, 2011-11-17 at 13:31 +1100, Michael Neuling wrote: >> From: Benjamin Herrenschmidt <benh@kernel.crashing.org> >> >> powerpc/ptrace: Fix build with gcc 4.6 >> >> gcc (rightfully) complains that we are accessing beyond the >> end of the fpr array (we do, to access the fpscr). > >This patch is still missing from the 3.0 stable series. > >Do we need to resend ? And resent to the correct stable address. cheers
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c index 05b7dd2..18447c4 100644 --- a/arch/powerpc/kernel/ptrace.c +++ b/arch/powerpc/kernel/ptrace.c @@ -1497,9 +1497,14 @@ long arch_ptrace(struct task_struct *child, long request, if (index < PT_FPR0) { tmp = ptrace_get_reg(child, (int) index); } else { + unsigned int fpidx = index - PT_FPR0; + flush_fp_to_thread(child); - tmp = ((unsigned long *)child->thread.fpr) - [TS_FPRWIDTH * (index - PT_FPR0)]; + if (fpidx < (PT_FPSCR - PT_FPR0)) + tmp = ((unsigned long *)child->thread.fpr) + [fpidx * TS_FPRWIDTH]; + else + tmp = child->thread.fpscr.val; } ret = put_user(tmp, datalp); break; @@ -1525,9 +1530,14 @@ long arch_ptrace(struct task_struct *child, long request, if (index < PT_FPR0) { ret = ptrace_put_reg(child, index, data); } else { + unsigned int fpidx = index - PT_FPR0; + flush_fp_to_thread(child); - ((unsigned long *)child->thread.fpr) - [TS_FPRWIDTH * (index - PT_FPR0)] = data; + if (fpidx < (PT_FPSCR - PT_FPR0)) + ((unsigned long *)child->thread.fpr) + [fpidx * TS_FPRWIDTH] = data; + else + child->thread.fpscr.val = data; ret = 0; } break;