Patchwork [14/39] powerpc: Alignment handler shouldn't access VSX registers with TS_FPR

login
register
mail settings
Submitter Anton Blanchard
Date Sept. 23, 2013, 2:04 a.m.
Message ID <1379901913-5945-15-git-send-email-anton@samba.org>
Download mbox | patch
Permalink /patch/277057/
State Accepted
Delegated to: Benjamin Herrenschmidt
Headers show

Comments

Anton Blanchard - Sept. 23, 2013, 2:04 a.m.
The TS_FPR macro selects the FPR component of a VSX register (the
high doubleword). emulate_vsx is using this macro to get the
address of the associated VSX register. This happens to work on big
endian, but fails on little endian.

Replace it with an explicit array access.

Signed-off-by: Anton Blanchard <anton@samba.org>
---
 arch/powerpc/kernel/align.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/arch/powerpc/kernel/align.c b/arch/powerpc/kernel/align.c
index 25d8d8b..3049bd0 100644
--- a/arch/powerpc/kernel/align.c
+++ b/arch/powerpc/kernel/align.c
@@ -650,7 +650,7 @@  static int emulate_vsx(unsigned char __user *addr, unsigned int reg,
 	flush_vsx_to_thread(current);
 
 	if (reg < 32)
-		ptr = (char *) &current->thread.TS_FPR(reg);
+		ptr = (char *) &current->thread.fpr[reg][0];
 	else
 		ptr = (char *) &current->thread.vr[reg - 32];