]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] sparse: partial mm/* __user annotation
authorAlexander Viro <viro@www.linux.org.uk>
Sat, 29 May 2004 04:14:50 +0000 (21:14 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Sat, 29 May 2004 04:14:50 +0000 (21:14 -0700)
mm/mempolicy.c
mm/mincore.c

index 496a6aae2d5846b830c19ce81e985014990aa3cb..a62a65c2e55c90d0521962ab1e3c8815eda492f5 100644 (file)
@@ -126,7 +126,7 @@ static int mpol_check_policy(int mode, unsigned long *nodes)
 }
 
 /* Copy a node mask from user space. */
-static int get_nodes(unsigned long *nodes, unsigned long *nmask,
+static int get_nodes(unsigned long *nodes, unsigned long __user *nmask,
                     unsigned long maxnode, int mode)
 {
        unsigned long k;
@@ -334,7 +334,7 @@ static int mbind_range(struct vm_area_struct *vma, unsigned long start,
 /* Change policy for a memory range */
 asmlinkage long sys_mbind(unsigned long start, unsigned long len,
                          unsigned long mode,
-                         unsigned long *nmask, unsigned long maxnode,
+                         unsigned long __user *nmask, unsigned long maxnode,
                          unsigned flags)
 {
        struct vm_area_struct *vma;
@@ -379,7 +379,7 @@ asmlinkage long sys_mbind(unsigned long start, unsigned long len,
 }
 
 /* Set the process memory policy */
-asmlinkage long sys_set_mempolicy(int mode, unsigned long *nmask,
+asmlinkage long sys_set_mempolicy(int mode, unsigned long __user *nmask,
                                   unsigned long maxnode)
 {
        int err;
@@ -443,7 +443,7 @@ static int lookup_node(struct mm_struct *mm, unsigned long addr)
 }
 
 /* Copy a kernel node mask to user space */
-static int copy_nodes_to_user(unsigned long *user_mask, unsigned long maxnode,
+static int copy_nodes_to_user(unsigned long __user *mask, unsigned long maxnode,
                              void *nodes, unsigned nbytes)
 {
        unsigned long copy = ALIGN(maxnode-1, 64) / 8;
@@ -451,16 +451,17 @@ static int copy_nodes_to_user(unsigned long *user_mask, unsigned long maxnode,
        if (copy > nbytes) {
                if (copy > PAGE_SIZE)
                        return -EINVAL;
-               if (clear_user((char*)user_mask + nbytes, copy - nbytes))
+               if (clear_user((char __user *)mask + nbytes, copy - nbytes))
                        return -EFAULT;
                copy = nbytes;
        }
-       return copy_to_user(user_mask, nodes, copy) ? -EFAULT : 0;
+       return copy_to_user(mask, nodes, copy) ? -EFAULT : 0;
 }
 
 /* Retrieve NUMA policy */
-asmlinkage long sys_get_mempolicy(int *policy,
-                                 unsigned long *nmask, unsigned long maxnode,
+asmlinkage long sys_get_mempolicy(int __user *policy,
+                                 unsigned long __user *nmask,
+                                 unsigned long maxnode,
                                  unsigned long addr, unsigned long flags)
 {
        int err, pval;
@@ -524,12 +525,12 @@ asmlinkage long sys_get_mempolicy(int *policy,
 
 #ifdef CONFIG_COMPAT
 /* The other functions are compatible */
-asmlinkage long compat_get_mempolicy(int *policy,
-                                 unsigned  *nmask, unsigned  maxnode,
+asmlinkage long compat_get_mempolicy(int __user *policy,
+                                 unsigned __user *nmask, unsigned  maxnode,
                                  unsigned addr, unsigned  flags)
 {
        long err;
-       unsigned long *nm = NULL;
+       unsigned long __user *nm = NULL;
        if (nmask)
                nm = compat_alloc_user_space(ALIGN(maxnode-1, 64) / 8);
        err = sys_get_mempolicy(policy, nm, maxnode, addr, flags);
@@ -756,7 +757,7 @@ int __mpol_equal(struct mempolicy *a, struct mempolicy *b)
 }
 
 /* Slow path of a mpol destructor. */
-extern void __mpol_free(struct mempolicy *p)
+void __mpol_free(struct mempolicy *p)
 {
        if (!atomic_dec_and_test(&p->refcnt))
                return;
index 379a277fd8b4b1acd6fa11b21fcc41d1c2ff18e0..eac70dbc4bd647a582f0be9d110b3746aa0216b1 100644 (file)
@@ -124,7 +124,7 @@ asmlinkage long sys_mincore(unsigned long start, size_t len,
                goto out;
 
        error = -EFAULT;
-       if (!access_ok(VERIFY_WRITE, (unsigned long) vec, len >> PAGE_SHIFT))
+       if (!access_ok(VERIFY_WRITE, vec, len >> PAGE_SHIFT))
                goto out;
 
        error = 0;