public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Andrew Morton <akpm@osdl.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] sparse: user annotations for s390 architecture
Date: Fri, 11 Jun 2004 17:21:20 +0200	[thread overview]
Message-ID: <200406111721.21335.arnd@arndb.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 33958 bytes --]

Lots of trivial changes to make sparse happy on s390 arch code,
mostly __user annotations.

 arch/s390/kernel/compat_signal.c |   54 ++++++++++++++++++++-------------------
 arch/s390/kernel/debug.c         |   24 ++++++++---------
 arch/s390/kernel/process.c       |   13 +++++----
 arch/s390/kernel/profile.c       |    3 +-
 arch/s390/kernel/ptrace.c        |   18 +++++++------
 arch/s390/kernel/signal.c        |   48 +++++++++++++++++++---------------
 arch/s390/kernel/sys_s390.c      |   46 ++++++++++++++++-----------------
 arch/s390/kernel/traps.c         |    4 +-
 arch/s390/mm/ioremap.c           |    2 -
 include/asm-s390/checksum.h      |    4 +-
 include/asm-s390/compat.h        |    8 ++---
 include/asm-s390/debug.h         |   23 +---------------
 include/asm-s390/idals.h         |    8 ++---
 include/asm-s390/ipc.h           |    2 -
 include/asm-s390/spinlock.h      |    8 ++---
 include/asm-s390/uaccess.h       |   46 ++++++++++++++++++++++++---------
 16 files changed, 164 insertions(+), 147 deletions(-)

Signed-off-by: Arnd Bergmann <arnd@arndb.de>

===== arch/s390/kernel/compat_signal.c 1.9 vs edited =====
--- 1.9/arch/s390/kernel/compat_signal.c	Sat Apr 17 20:19:30 2004
+++ edited/arch/s390/kernel/compat_signal.c	Sun Jun  6 22:49:58 2004
@@ -53,7 +53,7 @@
 
 asmlinkage int FASTCALL(do_signal(struct pt_regs *regs, sigset_t *oldset));
 
-int copy_siginfo_to_user32(siginfo_t32 *to, siginfo_t *from)
+int copy_siginfo_to_user32(siginfo_t32 __user *to, siginfo_t *from)
 {
 	int err;
 
@@ -130,7 +130,8 @@
 }
 
 asmlinkage int
-sys32_rt_sigsuspend(struct pt_regs * regs,compat_sigset_t *unewset, size_t sigsetsize)
+sys32_rt_sigsuspend(struct pt_regs * regs, compat_sigset_t __user *unewset,
+								size_t sigsetsize)
 {
 	sigset_t saveset, newset;
 	compat_sigset_t set32;
@@ -162,11 +163,11 @@
                 if (do_signal(regs, &saveset))
                         return -EINTR;
         }
-}                                                         
+}
 
 asmlinkage long
-sys32_sigaction(int sig, const struct old_sigaction32 *act,
-		 struct old_sigaction32 *oact)
+sys32_sigaction(int sig, const struct old_sigaction32 __user *act,
+		 struct old_sigaction32 __user *oact)
 {
         struct k_sigaction new_ka, old_ka;
         int ret;
@@ -199,9 +200,9 @@
 int
 do_sigaction(int sig, const struct k_sigaction *act, struct k_sigaction *oact);
 
-asmlinkage long 
-sys32_rt_sigaction(int sig, const struct sigaction32 *act,
-	   struct sigaction32 *oact,  size_t sigsetsize)
+asmlinkage long
+sys32_rt_sigaction(int sig, const struct sigaction32 __user *act,
+	   struct sigaction32 __user *oact,  size_t sigsetsize)
 {
 	struct k_sigaction new_ka, old_ka;
 	int ret;
@@ -258,7 +259,8 @@
 }
 
 asmlinkage long
-sys32_sigaltstack(const stack_t32 *uss, stack_t32 *uoss, struct pt_regs *regs)
+sys32_sigaltstack(const stack_t32 __user *uss, stack_t32 __user *uoss,
+							struct pt_regs *regs)
 {
 	stack_t kss, koss;
 	int ret, err = 0;
@@ -275,7 +277,9 @@
 	}
 
 	set_fs (KERNEL_DS);
-	ret = do_sigaltstack(uss ? &kss : NULL , uoss ? &koss : NULL, regs->gprs[15]);
+	ret = do_sigaltstack((stack_t __user *) (uss ? &kss : NULL),
+			     (stack_t __user *) (uoss ? &koss : NULL),
+			     regs->gprs[15]);
 	set_fs (old_fs);
 
 	if (!ret && uoss) {
@@ -290,7 +294,7 @@
 	return ret;
 }
 
-static int save_sigregs32(struct pt_regs *regs,_sigregs32 *sregs)
+static int save_sigregs32(struct pt_regs *regs, _sigregs32 __user *sregs)
 {
 	_s390_regs_common32 regs32;
 	int err, i;
@@ -311,7 +315,7 @@
 			      sizeof(_s390_fp_regs32));
 }
 
-static int restore_sigregs32(struct pt_regs *regs,_sigregs32 *sregs)
+static int restore_sigregs32(struct pt_regs *regs,_sigregs32 __user *sregs)
 {
 	_s390_regs_common32 regs32;
 	int err, i;
@@ -343,7 +347,7 @@
 
 asmlinkage long sys32_sigreturn(struct pt_regs *regs)
 {
-	sigframe32 *frame = (sigframe32 *)regs->gprs[15];
+	sigframe32 __user *frame = (sigframe32 __user *)regs->gprs[15];
 	sigset_t set;
 
 	if (verify_area(VERIFY_READ, frame, sizeof(*frame)))
@@ -365,11 +369,11 @@
 badframe:
 	force_sig(SIGSEGV, current);
 	return 0;
-}	
+}
 
 asmlinkage long sys32_rt_sigreturn(struct pt_regs *regs)
 {
-	rt_sigframe32 *frame = (rt_sigframe32 *)regs->gprs[15];
+	rt_sigframe32 __user *frame = (rt_sigframe32 __user *)regs->gprs[15];
 	sigset_t set;
 	stack_t st;
 	__u32 ss_sp;
@@ -399,8 +403,8 @@
 
 	/* It is more difficult to avoid calling this function than to
 	   call it and ignore errors.  */
-	set_fs (KERNEL_DS);   
-	do_sigaltstack(&st, NULL, regs->gprs[15]);
+	set_fs (KERNEL_DS);
+	do_sigaltstack((stack_t __user *)&st, NULL, regs->gprs[15]);
 	set_fs (old_fs);
 
 	return regs->gprs[2];
@@ -418,7 +422,7 @@
 /*
  * Determine which stack to use..
  */
-static inline void *
+static inline void __user *
 get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size)
 {
 	unsigned long sp;
@@ -439,7 +443,7 @@
 		sp = (unsigned long) ka->sa.sa_restorer;
 	}
 
-	return (void *)((sp - frame_size) & -8ul);
+	return (void __user *)((sp - frame_size) & -8ul);
 }
 
 static inline int map_signal(int sig)
@@ -455,7 +459,7 @@
 static void setup_frame32(int sig, struct k_sigaction *ka,
 			sigset_t *set, struct pt_regs * regs)
 {
-	sigframe32 *frame = get_sigframe(ka, regs, sizeof(sigframe32));
+	sigframe32 __user *frame = get_sigframe(ka, regs, sizeof(sigframe32));
 	if (!access_ok(VERIFY_WRITE, frame, sizeof(sigframe32)))
 		goto give_sigsegv;
 
@@ -474,12 +478,12 @@
 	} else {
 		regs->gprs[14] = (__u64) frame->retcode;
 		if (__put_user(S390_SYSCALL_OPCODE | __NR_sigreturn,
-		               (u16 *)(frame->retcode)))
+		               (u16 __user *)(frame->retcode)))
 			goto give_sigsegv;
         }
 
 	/* Set up backchain. */
-	if (__put_user(regs->gprs[15], (unsigned int *) frame))
+	if (__put_user(regs->gprs[15], (unsigned int __user *) frame))
 		goto give_sigsegv;
 
 	/* Set up registers for signal handler */
@@ -505,7 +509,7 @@
 			   sigset_t *set, struct pt_regs * regs)
 {
 	int err = 0;
-	rt_sigframe32 *frame = get_sigframe(ka, regs, sizeof(rt_sigframe32));
+	rt_sigframe32 __user *frame = get_sigframe(ka, regs, sizeof(rt_sigframe32));
 	if (!access_ok(VERIFY_WRITE, frame, sizeof(rt_sigframe32)))
 		goto give_sigsegv;
 
@@ -531,11 +535,11 @@
 	} else {
 		regs->gprs[14] = (__u64) frame->retcode;
 		err |= __put_user(S390_SYSCALL_OPCODE | __NR_rt_sigreturn,
-		                  (u16 *)(frame->retcode));
+		                  (u16 __user *)(frame->retcode));
 	}
 
 	/* Set up backchain. */
-	if (__put_user(regs->gprs[15], (unsigned int *) frame))
+	if (__put_user(regs->gprs[15], (unsigned int __user *) frame))
 		goto give_sigsegv;
 
 	/* Set up registers for signal handler */
===== arch/s390/kernel/debug.c 1.15 vs edited =====
--- 1.15/arch/s390/kernel/debug.c	Mon May 26 21:20:45 2003
+++ edited/arch/s390/kernel/debug.c	Sat Jun  5 13:18:43 2004
@@ -62,9 +62,9 @@
 /* internal function prototyes */
 
 static int debug_init(void);
-static ssize_t debug_output(struct file *file, char *user_buf,
+static ssize_t debug_output(struct file *file, char __user *user_buf,
 			    size_t user_len, loff_t * offset);
-static ssize_t debug_input(struct file *file, const char *user_buf,
+static ssize_t debug_input(struct file *file, const char __user *user_buf,
 			   size_t user_len, loff_t * offset);
 static int debug_open(struct inode *inode, struct file *file);
 static int debug_close(struct inode *inode, struct file *file);
@@ -74,10 +74,10 @@
 static int debug_prolog_level_fn(debug_info_t * id,
 				 struct debug_view *view, char *out_buf);
 static int debug_input_level_fn(debug_info_t * id, struct debug_view *view,
-				struct file *file, const char *user_buf,
+				struct file *file, const char __user *user_buf,
 				size_t user_buf_size, loff_t * offset);
 static int debug_input_flush_fn(debug_info_t * id, struct debug_view *view,
-                                struct file *file, const char *user_buf,
+                                struct file *file, const char __user *user_buf,
                                 size_t user_buf_size, loff_t * offset);
 static int debug_hex_ascii_format_fn(debug_info_t * id, struct debug_view *view,
                                 char *out_buf, const char *in_buf);
@@ -416,10 +416,10 @@
  * - copies formated debug entries to the user buffer
  */
 
-static ssize_t debug_output(struct file *file,	/* file descriptor */
-			    char *user_buf,	/* user buffer */
-			    size_t  len,	/* length of buffer */
-			    loff_t *offset	/* offset in the file */ )
+static ssize_t debug_output(struct file *file,		/* file descriptor */
+			    char __user *user_buf,	/* user buffer */
+			    size_t  len,		/* length of buffer */
+			    loff_t *offset)	      /* offset in the file */
 {
 	size_t count = 0;
 	size_t entry_offset, size = 0;
@@ -462,7 +462,7 @@
  */
 
 static ssize_t debug_input(struct file *file,
-			   const char *user_buf, size_t length,
+			   const char __user *user_buf, size_t length,
 			   loff_t *offset)
 {
 	int rc = 0;
@@ -942,7 +942,7 @@
  */
 
 static int debug_input_level_fn(debug_info_t * id, struct debug_view *view,
-				struct file *file, const char *user_buf,
+				struct file *file, const char __user *user_buf,
 				size_t in_buf_size, loff_t * offset)
 {
 	char input_buf[1];
@@ -1004,9 +1004,9 @@
 /*
  * view function: flushes debug areas 
  */
- 
+
 static int debug_input_flush_fn(debug_info_t * id, struct debug_view *view,
-                                struct file *file, const char *user_buf,
+                                struct file *file, const char __user *user_buf,
                                 size_t in_buf_size, loff_t * offset)
 {
         char input_buf[1];
===== arch/s390/kernel/process.c 1.25 vs edited =====
--- 1.25/arch/s390/kernel/process.c	Mon May 10 13:25:34 2004
+++ edited/arch/s390/kernel/process.c	Sat Jun  5 13:25:07 2004
@@ -16,6 +16,7 @@
  */
 
 #include <linux/config.h>
+#include <linux/compiler.h>
 #include <linux/errno.h>
 #include <linux/sched.h>
 #include <linux/kernel.h>
@@ -292,12 +293,12 @@
 {
         unsigned long clone_flags;
         unsigned long newsp;
-	int *parent_tidptr, *child_tidptr;
+	int __user *parent_tidptr, *child_tidptr;
 
         clone_flags = regs.gprs[3];
         newsp = regs.orig_gpr2;
-	parent_tidptr = (int *) regs.gprs[4];
-	child_tidptr = (int *) regs.gprs[5];
+	parent_tidptr = (int __user *) regs.gprs[4];
+	child_tidptr = (int __user *) regs.gprs[5];
         if (!newsp)
                 newsp = regs.gprs[15];
         return do_fork(clone_flags & ~CLONE_IDLETASK, newsp, &regs, 0,
@@ -328,12 +329,12 @@
         int error;
         char * filename;
 
-        filename = getname((char *) regs.orig_gpr2);
+        filename = getname((char __user *) regs.orig_gpr2);
         error = PTR_ERR(filename);
         if (IS_ERR(filename))
                 goto out;
-        error = do_execve(filename, (char **) regs.gprs[3],
-			  (char **) regs.gprs[4], &regs);
+        error = do_execve(filename, (char __user * __user *) regs.gprs[3],
+			  (char __user * __user *) regs.gprs[4], &regs);
 	if (error == 0) {
 		current->ptrace &= ~PT_DTRACE;
 		current->thread.fp_regs.fpc = 0;
===== arch/s390/kernel/profile.c 1.1 vs edited =====
--- 1.1/arch/s390/kernel/profile.c	Thu Apr 29 11:41:09 2004
+++ edited/arch/s390/kernel/profile.c	Sat Jun  5 13:19:22 2004
@@ -19,7 +19,8 @@
 	return len;
 }
 
-static int prof_cpu_mask_write_proc (struct file *file, const char *buffer,
+static int prof_cpu_mask_write_proc (struct file *file,
+					const char __user *buffer,
 					unsigned long count, void *data)
 {
 	cpumask_t *mask = (cpumask_t *)data;
===== arch/s390/kernel/ptrace.c 1.22 vs edited =====
--- 1.22/arch/s390/kernel/ptrace.c	Thu Apr 15 03:37:53 2004
+++ edited/arch/s390/kernel/ptrace.c	Sun Jun  6 20:56:40 2004
@@ -176,7 +176,7 @@
 	} else
 		tmp = 0;
 
-	return put_user(tmp, (addr_t *) data);
+	return put_user(tmp, (addr_t __user *) data);
 }
 
 /*
@@ -269,7 +269,7 @@
 		copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0);
 		if (copied != sizeof(tmp))
 			return -EIO;
-		return put_user(tmp, (unsigned long *) data);
+		return put_user(tmp, (unsigned long __user *) data);
 
 	case PTRACE_PEEKUSR:
 		/* read the word at location addr in the USER area. */
@@ -291,7 +291,8 @@
 
 	case PTRACE_PEEKUSR_AREA:
 	case PTRACE_POKEUSR_AREA:
-		if (copy_from_user(&parea, (void *) addr, sizeof(parea)))
+		if (copy_from_user(&parea, (void __user *) addr,
+							sizeof(parea)))
 			return -EFAULT;
 		addr = parea.kernel_addr;
 		data = parea.process_addr;
@@ -301,7 +302,7 @@
 				ret = peek_user(child, addr, data);
 			else {
 				addr_t tmp;
-				if (get_user (tmp, (addr_t *) data))
+				if (get_user (tmp, (addr_t __user *) data))
 					return -EFAULT;
 				ret = poke_user(child, addr, tmp);
 			}
@@ -402,7 +403,7 @@
 	} else
 		tmp = 0;
 
-	return put_user(tmp, (__u32 *) data);
+	return put_user(tmp, (__u32 __user *) data);
 }
 
 /*
@@ -509,7 +510,7 @@
 		copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0);
 		if (copied != sizeof(tmp))
 			return -EIO;
-		return put_user(tmp, (unsigned int *) data);
+		return put_user(tmp, (unsigned int __user *) data);
 
 	case PTRACE_PEEKUSR:
 		/* read the word at location addr in the USER area. */
@@ -530,7 +531,8 @@
 
 	case PTRACE_PEEKUSR_AREA:
 	case PTRACE_POKEUSR_AREA:
-		if (copy_from_user(&parea, (void *) addr, sizeof(parea)))
+		if (copy_from_user(&parea, (void __user *) addr,
+							sizeof(parea)))
 			return -EFAULT;
 		addr = parea.kernel_addr;
 		data = parea.process_addr;
@@ -540,7 +542,7 @@
 				ret = peek_user_emu31(child, addr, data);
 			else {
 				__u32 tmp;
-				if (get_user (tmp, (__u32 *) data))
+				if (get_user (tmp, (__u32 __user *) data))
 					return -EFAULT;
 				ret = poke_user_emu31(child, addr, tmp);
 			}
===== arch/s390/kernel/signal.c 1.25 vs edited =====
--- 1.25/arch/s390/kernel/signal.c	Sat Mar 27 12:40:46 2004
+++ edited/arch/s390/kernel/signal.c	Sat Jun  5 17:44:23 2004
@@ -77,8 +77,9 @@
 	}
 }
 
-asmlinkage int
-sys_rt_sigsuspend(struct pt_regs * regs,sigset_t *unewset, size_t sigsetsize)
+asmlinkage long
+sys_rt_sigsuspend(struct pt_regs *regs, sigset_t __user *unewset,
+						size_t sigsetsize)
 {
 	sigset_t saveset, newset;
 
@@ -105,9 +106,9 @@
 	}
 }
 
-asmlinkage int 
-sys_sigaction(int sig, const struct old_sigaction *act,
-	      struct old_sigaction *oact)
+asmlinkage long
+sys_sigaction(int sig, const struct old_sigaction __user *act,
+	      struct old_sigaction __user *oact)
 {
 	struct k_sigaction new_ka, old_ka;
 	int ret;
@@ -137,8 +138,9 @@
 	return ret;
 }
 
-asmlinkage int
-sys_sigaltstack(const stack_t *uss, stack_t *uoss, struct pt_regs *regs)
+asmlinkage long
+sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
+					struct pt_regs *regs)
 {
 	return do_sigaltstack(uss, uoss, regs->gprs[15]);
 }
@@ -146,7 +148,7 @@
 
 
 /* Returns non-zero on fault. */
-static int save_sigregs(struct pt_regs *regs, _sigregs *sregs)
+static int save_sigregs(struct pt_regs *regs, _sigregs __user *sregs)
 {
 	unsigned long old_mask = regs->psw.mask;
 	int err;
@@ -175,7 +177,7 @@
 }
 
 /* Returns positive number on error */
-static int restore_sigregs(struct pt_regs *regs, _sigregs *sregs)
+static int restore_sigregs(struct pt_regs *regs, _sigregs __user *sregs)
 {
 	unsigned long old_mask = regs->psw.mask;
 	int err;
@@ -208,7 +210,7 @@
 
 asmlinkage long sys_sigreturn(struct pt_regs *regs)
 {
-	sigframe *frame = (sigframe *)regs->gprs[15];
+	sigframe __user *frame = (sigframe __user *)regs->gprs[15];
 	sigset_t set;
 
 	if (verify_area(VERIFY_READ, frame, sizeof(*frame)))
@@ -234,7 +236,7 @@
 
 asmlinkage long sys_rt_sigreturn(struct pt_regs *regs)
 {
-	rt_sigframe *frame = (rt_sigframe *)regs->gprs[15];
+	rt_sigframe __user *frame = (rt_sigframe __user *)regs->gprs[15];
 	sigset_t set;
 
 	if (verify_area(VERIFY_READ, frame, sizeof(*frame)))
@@ -269,7 +271,7 @@
 /*
  * Determine which stack to use..
  */
-static inline void *
+static inline void __user *
 get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size)
 {
 	unsigned long sp;
@@ -290,7 +292,7 @@
 		sp = (unsigned long) ka->sa.sa_restorer;
 	}
 
-	return (void *)((sp - frame_size) & -8ul);
+	return (void __user *)((sp - frame_size) & -8ul);
 }
 
 static inline int map_signal(int sig)
@@ -306,7 +308,9 @@
 static void setup_frame(int sig, struct k_sigaction *ka,
 			sigset_t *set, struct pt_regs * regs)
 {
-	sigframe *frame = get_sigframe(ka, regs, sizeof(sigframe));
+	sigframe __user *frame;
+
+	frame = get_sigframe(ka, regs, sizeof(sigframe));
 	if (!access_ok(VERIFY_WRITE, frame, sizeof(sigframe)))
 		goto give_sigsegv;
 
@@ -326,13 +330,13 @@
 	} else {
                 regs->gprs[14] = (unsigned long)
 			frame->retcode | PSW_ADDR_AMODE;
-		if (__put_user(S390_SYSCALL_OPCODE | __NR_sigreturn, 
-	                       (u16 *)(frame->retcode)))
+		if (__put_user(S390_SYSCALL_OPCODE | __NR_sigreturn,
+	                       (u16 __user *)(frame->retcode)))
 			goto give_sigsegv;
 	}
 
 	/* Set up backchain. */
-	if (__put_user(regs->gprs[15], (addr_t *) frame))
+	if (__put_user(regs->gprs[15], (addr_t __user *) frame))
 		goto give_sigsegv;
 
 	/* Set up registers for signal handler */
@@ -358,7 +362,9 @@
 			   sigset_t *set, struct pt_regs * regs)
 {
 	int err = 0;
-	rt_sigframe *frame = get_sigframe(ka, regs, sizeof(rt_sigframe));
+	rt_sigframe __user *frame;
+
+	frame = get_sigframe(ka, regs, sizeof(rt_sigframe));
 	if (!access_ok(VERIFY_WRITE, frame, sizeof(rt_sigframe)))
 		goto give_sigsegv;
 
@@ -385,12 +391,12 @@
 	} else {
                 regs->gprs[14] = (unsigned long)
 			frame->retcode | PSW_ADDR_AMODE;
-		err |= __put_user(S390_SYSCALL_OPCODE | __NR_rt_sigreturn, 
-	                          (u16 *)(frame->retcode));
+		err |= __put_user(S390_SYSCALL_OPCODE | __NR_rt_sigreturn,
+	                          (u16 __user *)(frame->retcode));
 	}
 
 	/* Set up backchain. */
-	if (__put_user(regs->gprs[15], (addr_t *) frame))
+	if (__put_user(regs->gprs[15], (addr_t __user *) frame))
 		goto give_sigsegv;
 
 	/* Set up registers for signal handler */
===== arch/s390/kernel/sys_s390.c 1.14 vs edited =====
--- 1.14/arch/s390/kernel/sys_s390.c	Sat May 15 04:00:18 2004
+++ edited/arch/s390/kernel/sys_s390.c	Sun Jun  6 20:55:16 2004
@@ -37,7 +37,7 @@
  * sys_pipe() is the normal C calling standard for creating
  * a pipe. It's not the way Unix traditionally does this, though.
  */
-asmlinkage long sys_pipe(unsigned long * fildes)
+asmlinkage long sys_pipe(unsigned long __user *fildes)
 {
 	int fd[2];
 	int error;
@@ -92,7 +92,7 @@
 	unsigned long offset;
 };
 
-asmlinkage long sys_mmap2(struct mmap_arg_struct *arg)
+asmlinkage long sys_mmap2(struct mmap_arg_struct __user  *arg)
 {
 	struct mmap_arg_struct a;
 	int error = -EFAULT;
@@ -104,7 +104,7 @@
 	return error;
 }
 
-asmlinkage long old_mmap(struct mmap_arg_struct *arg)
+asmlinkage long old_mmap(struct mmap_arg_struct __user *arg)
 {
 	struct mmap_arg_struct a;
 	long error = -EFAULT;
@@ -128,7 +128,7 @@
 	struct timeval *tvp;
 };
 
-asmlinkage long old_select(struct sel_arg_struct *arg)
+asmlinkage long old_select(struct sel_arg_struct __user *arg)
 {
 	struct sel_arg_struct a;
 
@@ -145,37 +145,37 @@
  *
  * This is really horribly ugly.
  */
-asmlinkage long sys_ipc (uint call, int first, int second,
-				  unsigned long third, void *ptr)
+asmlinkage long sys_ipc(uint call, int first, int second,
+				  unsigned long third, void __user *ptr)
 {
         struct ipc_kludge tmp;
 	int ret;
 
         switch (call) {
         case SEMOP:
-		return sys_semtimedop (first, (struct sembuf *) ptr, second,
+		return sys_semtimedop (first, (struct sembuf __user *) ptr, second,
 				       NULL);
 	case SEMTIMEDOP:
-		return sys_semtimedop (first, (struct sembuf *) ptr, second,
-				       (const struct timespec *) third);
+		return sys_semtimedop (first, (struct sembuf __user *) ptr, second,
+				       (const struct timespec __user *) third);
         case SEMGET:
                 return sys_semget (first, second, third);
         case SEMCTL: {
                 union semun fourth;
                 if (!ptr)
                         return -EINVAL;
-                if (get_user(fourth.__pad, (void **) ptr))
+                if (get_user(fourth.__pad, (void __user * __user *) ptr))
                         return -EFAULT;
                 return sys_semctl (first, second, third, fourth);
-        } 
+        }
         case MSGSND:
-		return sys_msgsnd (first, (struct msgbuf *) ptr, 
+		return sys_msgsnd (first, (struct msgbuf __user *) ptr,
                                    second, third);
 		break;
         case MSGRCV:
                 if (!ptr)
                         return -EINVAL;
-                if (copy_from_user (&tmp, (struct ipc_kludge *) ptr,
+                if (copy_from_user (&tmp, (struct ipc_kludge __user *) ptr,
                                     sizeof (struct ipc_kludge)))
                         return -EFAULT;
                 return sys_msgrcv (first, tmp.msgp,
@@ -183,33 +183,33 @@
         case MSGGET:
                 return sys_msgget ((key_t) first, second);
         case MSGCTL:
-                return sys_msgctl (first, second, (struct msqid_ds *) ptr);
-                
+                return sys_msgctl (first, second, (struct msqid_ds __user *) ptr);
+
 	case SHMAT: {
 		ulong raddr;
-		ret = do_shmat (first, (char *) ptr, second, &raddr);
+		ret = do_shmat (first, (char __user *) ptr, second, &raddr);
 		if (ret)
 			return ret;
-		return put_user (raddr, (ulong *) third);
+		return put_user (raddr, (ulong __user *) third);
 		break;
         }
-	case SHMDT: 
-		return sys_shmdt ((char *)ptr);
+	case SHMDT:
+		return sys_shmdt ((char __user *)ptr);
 	case SHMGET:
 		return sys_shmget (first, second, third);
 	case SHMCTL:
 		return sys_shmctl (first, second,
-                                   (struct shmid_ds *) ptr);
+                                   (struct shmid_ds __user *) ptr);
 	default:
 		return -ENOSYS;
 
 	}
-        
+
 	return -EINVAL;
 }
 
 #ifdef CONFIG_ARCH_S390X
-asmlinkage long s390x_newuname(struct new_utsname * name)
+asmlinkage long s390x_newuname(struct new_utsname __user *name)
 {
 	int ret = sys_newuname(name);
 
@@ -256,7 +256,7 @@
 };
 
 asmlinkage long
-s390_fadvise64_64(struct fadvise64_64_args *args)
+s390_fadvise64_64(struct fadvise64_64_args __user *args)
 {
 	struct fadvise64_64_args a;
 
===== arch/s390/kernel/traps.c 1.29 vs edited =====
--- 1.29/arch/s390/kernel/traps.c	Tue Apr 27 07:07:43 2004
+++ edited/arch/s390/kernel/traps.c	Sun Jun  6 20:54:27 2004
@@ -188,7 +188,7 @@
 	printk("%s Code: ", mode);
 	for (i = 0; i < 20; i++) {
 		unsigned char c;
-		if (__get_user(c, (char *)(regs->psw.addr + i))) {
+		if (__get_user(c, (char __user *)(regs->psw.addr + i))) {
 			printk(" Bad PSW.");
 			break;
 		}
@@ -391,7 +391,7 @@
 		local_irq_enable();
 
 	if (regs->psw.mask & PSW_MASK_PSTATE)
-		get_user(*((__u16 *) opcode), location);
+		get_user(*((__u16 *) opcode), (__u16 __user *)location);
 	else
 		*((__u16 *)opcode)=*((__u16 *)location);
 	if (*((__u16 *)opcode)==S390_BREAKPOINT_U16)
===== arch/s390/mm/ioremap.c 1.8 vs edited =====
--- 1.8/arch/s390/mm/ioremap.c	Thu Oct  2 09:11:59 2003
+++ edited/arch/s390/mm/ioremap.c	Sat Jun  5 13:31:28 2004
@@ -134,5 +134,5 @@
 void iounmap(void *addr)
 {
 	if (addr > high_memory)
-		return vfree(addr);
+		vfree(addr);
 }
===== include/asm-s390/checksum.h 1.11 vs edited =====
--- 1.11/include/asm-s390/checksum.h	Sat Jan 31 09:15:34 2004
+++ edited/include/asm-s390/checksum.h	Sun Jun  6 23:21:09 2004
@@ -93,8 +93,8 @@
  * Copy from userspace and compute checksum.  If we catch an exception
  * then zero the rest of the buffer.
  */
-static inline unsigned int 
-csum_partial_copy_from_user (const char *src, char *dst,
+static inline unsigned int
+csum_partial_copy_from_user(const char __user *src, char *dst,
                                           int len, unsigned int sum,
                                           int *err_ptr)
 {
===== include/asm-s390/compat.h 1.6 vs edited =====
--- 1.6/include/asm-s390/compat.h	Mon Mar 15 15:22:21 2004
+++ edited/include/asm-s390/compat.h	Sat Jun  5 16:38:46 2004
@@ -123,19 +123,19 @@
  */
 typedef	u32		compat_uptr_t;
 
-static inline void *compat_ptr(compat_uptr_t uptr)
+static inline void __user *compat_ptr(compat_uptr_t uptr)
 {
-	return (void *)(unsigned long)(uptr & 0x7fffffffUL);
+	return (void __user *)(unsigned long)(uptr & 0x7fffffffUL);
 }
 
-static inline void *compat_alloc_user_space(long len)
+static inline void __user *compat_alloc_user_space(long len)
 {
 	unsigned long stack;
 
 	stack = KSTK_ESP(current);
 	if (test_thread_flag(TIF_31BIT))
 		stack &= 0x7fffffffUL;
-	return (void *) (stack - len);
+	return (void __user *) (stack - len);
 }
 
 struct compat_ipc64_perm {
===== include/asm-s390/debug.h 1.9 vs edited =====
--- 1.9/include/asm-s390/debug.h	Thu Feb 26 12:21:51 2004
+++ edited/include/asm-s390/debug.h	Sat Jun  5 13:17:08 2004
@@ -91,7 +91,8 @@
 				   char* out_buf);
 typedef int (debug_input_proc_t) (debug_info_t* id,
 				  struct debug_view* view,
-				  struct file* file, const char* user_buf,
+				  struct file* file,
+				  const char __user *user_buf,
 				  size_t in_buf_size, loff_t* offset);
 
 int debug_dflt_header_fn(debug_info_t* id, struct debug_view* view,
@@ -232,26 +233,6 @@
 #define PRINT_WARN(x...) printk ( KERN_DEBUG PRINTK_HEADER x )
 #define PRINT_ERR(x...) printk ( KERN_DEBUG PRINTK_HEADER x )
 #define PRINT_FATAL(x...) printk ( KERN_DEBUG PRINTK_HEADER x )
-#endif				/* DASD_DEBUG */
-
-#if DASD_DEBUG > 4
-#define INTERNAL_ERROR(x...) PRINT_FATAL ( INTERNAL_ERRMSG ( x ) )
-#elif DASD_DEBUG > 2
-#define INTERNAL_ERROR(x...) PRINT_ERR ( INTERNAL_ERRMSG ( x ) )
-#elif DASD_DEBUG > 0
-#define INTERNAL_ERROR(x...) PRINT_WARN ( INTERNAL_ERRMSG ( x ) )
-#else
-#define INTERNAL_ERROR(x...)
-#endif				/* DASD_DEBUG */
-
-#if DASD_DEBUG > 5
-#define INTERNAL_CHECK(x...) PRINT_FATAL ( INTERNAL_CHKMSG ( x ) )
-#elif DASD_DEBUG > 3
-#define INTERNAL_CHECK(x...) PRINT_ERR ( INTERNAL_CHKMSG ( x ) )
-#elif DASD_DEBUG > 1
-#define INTERNAL_CHECK(x...) PRINT_WARN ( INTERNAL_CHKMSG ( x ) )
-#else
-#define INTERNAL_CHECK(x...)
 #endif				/* DASD_DEBUG */
 
 #undef DEBUG_MALLOC
===== include/asm-s390/idals.h 1.9 vs edited =====
--- 1.9/include/asm-s390/idals.h	Thu Feb 26 12:21:51 2004
+++ edited/include/asm-s390/idals.h	Sun Jun  6 19:31:40 2004
@@ -218,7 +218,7 @@
  * Copy count bytes from an idal buffer to user memory
  */
 static inline size_t
-idal_buffer_to_user(struct idal_buffer *ib, void *to, size_t count)
+idal_buffer_to_user(struct idal_buffer *ib, void __user *to, size_t count)
 {
 	size_t left;
 	int i;
@@ -228,7 +228,7 @@
 		left = copy_to_user(to, ib->data[i], IDA_BLOCK_SIZE);
 		if (left)
 			return left + count - IDA_BLOCK_SIZE;
-		to = (void *) to + IDA_BLOCK_SIZE;
+		to = (void __user *) to + IDA_BLOCK_SIZE;
 		count -= IDA_BLOCK_SIZE;
 	}
 	return copy_to_user(to, ib->data[i], count);
@@ -238,7 +238,7 @@
  * Copy count bytes from user memory to an idal buffer
  */
 static inline size_t
-idal_buffer_from_user(struct idal_buffer *ib, const void *from, size_t count)
+idal_buffer_from_user(struct idal_buffer *ib, const void __user *from, size_t count)
 {
 	size_t left;
 	int i;
@@ -248,7 +248,7 @@
 		left = copy_from_user(ib->data[i], from, IDA_BLOCK_SIZE);
 		if (left)
 			return left + count - IDA_BLOCK_SIZE;
-		from = (void *) from + IDA_BLOCK_SIZE;
+		from = (void __user *) from + IDA_BLOCK_SIZE;
 		count -= IDA_BLOCK_SIZE;
 	}
 	return copy_from_user(ib->data[i], from, count);
===== include/asm-s390/ipc.h 1.2 vs edited =====
--- 1.2/include/asm-s390/ipc.h	Mon Apr 14 21:11:58 2003
+++ edited/include/asm-s390/ipc.h	Sat Jun  5 12:56:51 2004
@@ -15,7 +15,7 @@
  * See arch/s390/kernel/sys_s390.c for ugly details..
  */
 struct ipc_kludge {
-	struct msgbuf *msgp;
+	struct msgbuf __user *msgp;
 	long msgtyp;
 };
 
===== include/asm-s390/spinlock.h 1.15 vs edited =====
--- 1.15/include/asm-s390/spinlock.h	Mon May 10 13:25:44 2004
+++ edited/include/asm-s390/spinlock.h	Sat Jun  5 12:42:34 2004
@@ -48,7 +48,7 @@
 {
 #ifndef __s390x__
 	unsigned int reg1, reg2;
-        __asm__ __volatile("    bras  %0,1f\n"
+        __asm__ __volatile__("    bras  %0,1f\n"
                            "0:  diag  0,0,68\n"
                            "1:  slr   %1,%1\n"
                            "    cs    %1,%0,0(%3)\n"
@@ -58,7 +58,7 @@
 			   : "cc", "memory" );
 #else /* __s390x__ */
 	unsigned long reg1, reg2;
-        __asm__ __volatile("    bras  %1,1f\n"
+        __asm__ __volatile__("    bras  %1,1f\n"
                            "0:  " __DIAG44_INSN " 0,%4\n"
                            "1:  slr   %0,%0\n"
                            "    cs    %0,%1,0(%3)\n"
@@ -74,7 +74,7 @@
 	unsigned long reg;
 	unsigned int result;
 
-	__asm__ __volatile("    basr  %1,0\n"
+	__asm__ __volatile__("    basr  %1,0\n"
 			   "0:  cs    %0,%1,0(%3)"
 			   : "=d" (result), "=&d" (reg), "=m" (lp->lock)
 			   : "a" (&lp->lock), "m" (lp->lock), "0" (0)
@@ -86,7 +86,7 @@
 {
 	unsigned int old;
 
-	__asm__ __volatile("cs %0,%3,0(%4)"
+	__asm__ __volatile__("cs %0,%3,0(%4)"
 			   : "=d" (old), "=m" (lp->lock)
 			   : "0" (lp->lock), "d" (0), "a" (lp)
 			   : "cc", "memory" );
===== include/asm-s390/uaccess.h 1.17 vs edited =====
--- 1.17/include/asm-s390/uaccess.h	Thu Jun  3 10:46:41 2004
+++ edited/include/asm-s390/uaccess.h	Sun Jun  6 20:38:13 2004
@@ -65,9 +65,10 @@
 
 #define access_ok(type,addr,size) __access_ok(addr,size)
 
-extern inline int verify_area(int type, const void * addr, unsigned long size)
+extern inline int verify_area(int type, const void __user *addr,
+						unsigned long size)
 {
-        return access_ok(type,addr,size)?0:-EFAULT;
+	return access_ok(type, addr, size) ? 0 : -EFAULT;
 }
 
 /*
@@ -147,6 +148,7 @@
 })
 #endif
 
+#ifndef __CHECKER__
 #define __put_user(x, ptr) \
 ({								\
 	__typeof__(*(ptr)) __x = (x);				\
@@ -164,6 +166,14 @@
 	 }							\
 	__pu_err;						\
 })
+#else
+#define __put_user(x, ptr)			\
+({						\
+	void __user *p;				\
+	p = (ptr);				\
+	0;					\
+})
+#endif
 
 #define put_user(x, ptr)					\
 ({								\
@@ -202,6 +212,7 @@
 })
 #endif
 
+#ifndef __CHECKER__
 #define __get_user(x, ptr)					\
 ({								\
 	__typeof__(*(ptr)) __x;					\
@@ -221,6 +232,15 @@
 	(x) = __x;						\
 	__gu_err;						\
 })
+#else
+#define __get_user(x, ptr)			\
+({						\
+	void __user *p;				\
+	p = (ptr);				\
+	0;					\
+})
+#endif
+
 
 #define get_user(x, ptr)					\
 ({								\
@@ -230,7 +250,7 @@
 
 extern int __get_user_bad(void);
 
-extern long __copy_to_user_asm(const void *from, long n, void *to);
+extern long __copy_to_user_asm(const void *from, long n, void __user *to);
 
 /**
  * __copy_to_user: - Copy a block of data into user space, with less checking.
@@ -274,7 +294,7 @@
 	return n;
 }
 
-extern long __copy_from_user_asm(void *to, long n, const void *from);
+extern long __copy_from_user_asm(void *to, long n, const void __user *from);
 
 /**
  * __copy_from_user: - Copy a block of data from user space, with less checking.
@@ -326,7 +346,8 @@
 	return n;
 }
 
-extern unsigned long __copy_in_user_asm(const void *from, long n, void *to);
+extern unsigned long __copy_in_user_asm(const void __user *from, long n,
+							void __user *to);
 
 static inline unsigned long
 __copy_in_user(void __user *to, const void __user *from, unsigned long n)
@@ -346,10 +366,11 @@
 /*
  * Copy a null terminated string from userspace.
  */
-extern long __strncpy_from_user_asm(char *dst, const char *src, long count);
+extern long __strncpy_from_user_asm(char *dst, const char __user *src,
+								long count);
 
 static inline long
-strncpy_from_user(char *dst, const char *src, long count)
+strncpy_from_user(char *dst, const char __user *src, long count)
 {
         long res = -EFAULT;
         might_sleep();
@@ -359,10 +379,10 @@
 }
 
 
-extern long __strnlen_user_asm(const char *src, long count);
+extern long __strnlen_user_asm(const char __user *src, long count);
 
 static inline unsigned long
-strnlen_user(const char * src, unsigned long n)
+strnlen_user(const char __user * src, unsigned long n)
 {
 	might_sleep();
 	return __strnlen_user_asm(src, n);
@@ -388,16 +408,16 @@
  * Zero Userspace
  */
 
-extern long __clear_user_asm(void *to, long n);
+extern long __clear_user_asm(void __user *to, long n);
 
 static inline unsigned long
-__clear_user(void *to, unsigned long n)
+__clear_user(void __user *to, unsigned long n)
 {
 	return __clear_user_asm(to, n);
 }
 
 static inline unsigned long
-clear_user(void *to, unsigned long n)
+clear_user(void __user *to, unsigned long n)
 {
 	might_sleep();
 	if (access_ok(VERIFY_WRITE, to, n))

[-- Attachment #2: signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

                 reply	other threads:[~2004-06-11 15:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200406111721.21335.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=schwidefsky@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox