From 032e7cc1a5749091e64fe4b3fac8c7c8b4b31180 Mon Sep 17 00:00:00 2001
From: "David S. Miller" <davem@nuts.ninka.net>
Date: Fri, 30 May 2003 10:54:45 -0700
Subject: [PATCH] [SPARC64]: Fix sys_shmat handling for 64-bit binaries.

---
 arch/sparc64/kernel/sys_sparc.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/sparc64/kernel/sys_sparc.c b/arch/sparc64/kernel/sys_sparc.c
index 5cbee39b42a5..7b1052dadcb5 100644
--- a/arch/sparc64/kernel/sys_sparc.c
+++ b/arch/sparc64/kernel/sys_sparc.c
@@ -223,9 +223,15 @@ asmlinkage int sys_ipc (unsigned call, int first, int second, unsigned long thir
 		}
 	if (call <= SHMCTL) 
 		switch (call) {
-		case SHMAT:
-			err = sys_shmat (first, (char *) ptr, second, (ulong *) third);
+		case SHMAT: {
+			ulong raddr;
+			err = sys_shmat (first, (char *) ptr, second, &raddr);
+			if (!err) {
+				if (put_user(raddr, (ulong __user *) third))
+					err = -EFAULT;
+			}
 			goto out;
+		}
 		case SHMDT:
 			err = sys_shmdt ((char *)ptr);
 			goto out;
-- 
2.30.9