more gcc 3.5 stuff

Anton Blanchard anton at samba.org
Tue Apr 13 20:53:41 EST 2004


Hi,

gcc 3.5 doesnt like signal32.c, I made these changes a while ago but
didnt get past a quick boot test. Ben, do they look OK?

Anton

diff -puN arch/ppc64/kernel/signal32.c~gcc-3.5fixes arch/ppc64/kernel/signal32.c
--- foobar2/arch/ppc64/kernel/signal32.c~gcc-3.5fixes	2004-02-29 15:59:43.880544559 +1100
+++ foobar2-anton/arch/ppc64/kernel/signal32.c	2004-02-29 16:11:23.472388589 +1100
@@ -297,12 +297,15 @@ long sys32_sigaction(int sig, struct old

 	if (act) {
 		compat_old_sigset_t mask;
+		compat_uptr_t handler, restorer;

-		if (get_user((long)new_ka.sa.sa_handler, &act->sa_handler) ||
-		    __get_user((long)new_ka.sa.sa_restorer, &act->sa_restorer) ||
+		if (get_user(handler, &act->sa_handler) ||
+		    __get_user(restorer, &act->sa_restorer) ||
 		    __get_user(new_ka.sa.sa_flags, &act->sa_flags) ||
 		    __get_user(mask, &act->sa_mask))
 			return -EFAULT;
+		new_ka.sa.sa_handler = compat_ptr(handler);
+		new_ka.sa.sa_restorer = compat_ptr(restorer);
 		siginitset(&new_ka.sa.sa_mask, mask);
 	}

@@ -353,7 +356,10 @@ long sys32_rt_sigaction(int sig, const s
 		return -EINVAL;

 	if (act) {
-		ret = get_user((long)new_ka.sa.sa_handler, &act->sa_handler);
+		compat_uptr_t handler;
+
+		ret = get_user(handler, &act->sa_handler);
+		new_ka.sa.sa_handler = compat_ptr(handler);
 		ret |= __copy_from_user(&set32, &act->sa_mask,
 					sizeof(compat_sigset_t));
 		sigset_from_compat(&new_ka.sa.sa_mask, &set32);
@@ -618,6 +624,7 @@ int sys32_sigaltstack(u32 newstack, u32
 	int ret;
 	mm_segment_t old_fs;
 	unsigned long sp;
+	compat_uptr_t ss_sp;

 	/*
 	 * set sp to the user stack on entry to the system call
@@ -626,14 +633,16 @@ int sys32_sigaltstack(u32 newstack, u32
 	sp = regs->gpr[1];

 	/* Put new stack info in local 64 bit stack struct */
-	if (newstack &&
-		(get_user((long)uss.ss_sp,
-			  &((stack_32_t *)(long)newstack)->ss_sp) ||
-		 __get_user(uss.ss_flags,
-			 &((stack_32_t *)(long)newstack)->ss_flags) ||
-		 __get_user(uss.ss_size,
-			 &((stack_32_t *)(long)newstack)->ss_size)))
-		return -EFAULT;
+	if (newstack) {
+			if (get_user(ss_sp,
+			  	&((stack_32_t *)(long)newstack)->ss_sp) ||
+		 	__get_user(uss.ss_flags,
+			 	&((stack_32_t *)(long)newstack)->ss_flags) ||
+		 	__get_user(uss.ss_size,
+			 	&((stack_32_t *)(long)newstack)->ss_size))
+				return -EFAULT;
+		uss.ss_sp = compat_ptr(ss_sp);
+	}

 	old_fs = get_fs();
 	set_fs(KERNEL_DS);

** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/





More information about the Linuxppc64-dev mailing list