Commit c4787237 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] sparse: partial mm/* __user annotation

parent 20158e4d
...@@ -126,7 +126,7 @@ static int mpol_check_policy(int mode, unsigned long *nodes) ...@@ -126,7 +126,7 @@ static int mpol_check_policy(int mode, unsigned long *nodes)
} }
/* Copy a node mask from user space. */ /* 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 maxnode, int mode)
{ {
unsigned long k; unsigned long k;
...@@ -334,7 +334,7 @@ static int mbind_range(struct vm_area_struct *vma, unsigned long start, ...@@ -334,7 +334,7 @@ static int mbind_range(struct vm_area_struct *vma, unsigned long start,
/* Change policy for a memory range */ /* Change policy for a memory range */
asmlinkage long sys_mbind(unsigned long start, unsigned long len, asmlinkage long sys_mbind(unsigned long start, unsigned long len,
unsigned long mode, unsigned long mode,
unsigned long *nmask, unsigned long maxnode, unsigned long __user *nmask, unsigned long maxnode,
unsigned flags) unsigned flags)
{ {
struct vm_area_struct *vma; struct vm_area_struct *vma;
...@@ -379,7 +379,7 @@ asmlinkage long sys_mbind(unsigned long start, unsigned long len, ...@@ -379,7 +379,7 @@ asmlinkage long sys_mbind(unsigned long start, unsigned long len,
} }
/* Set the process memory policy */ /* 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) unsigned long maxnode)
{ {
int err; int err;
...@@ -443,7 +443,7 @@ static int lookup_node(struct mm_struct *mm, unsigned long addr) ...@@ -443,7 +443,7 @@ static int lookup_node(struct mm_struct *mm, unsigned long addr)
} }
/* Copy a kernel node mask to user space */ /* 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) void *nodes, unsigned nbytes)
{ {
unsigned long copy = ALIGN(maxnode-1, 64) / 8; 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, ...@@ -451,16 +451,17 @@ static int copy_nodes_to_user(unsigned long *user_mask, unsigned long maxnode,
if (copy > nbytes) { if (copy > nbytes) {
if (copy > PAGE_SIZE) if (copy > PAGE_SIZE)
return -EINVAL; return -EINVAL;
if (clear_user((char*)user_mask + nbytes, copy - nbytes)) if (clear_user((char __user *)mask + nbytes, copy - nbytes))
return -EFAULT; return -EFAULT;
copy = nbytes; copy = nbytes;
} }
return copy_to_user(user_mask, nodes, copy) ? -EFAULT : 0; return copy_to_user(mask, nodes, copy) ? -EFAULT : 0;
} }
/* Retrieve NUMA policy */ /* Retrieve NUMA policy */
asmlinkage long sys_get_mempolicy(int *policy, asmlinkage long sys_get_mempolicy(int __user *policy,
unsigned long *nmask, unsigned long maxnode, unsigned long __user *nmask,
unsigned long maxnode,
unsigned long addr, unsigned long flags) unsigned long addr, unsigned long flags)
{ {
int err, pval; int err, pval;
...@@ -524,12 +525,12 @@ asmlinkage long sys_get_mempolicy(int *policy, ...@@ -524,12 +525,12 @@ asmlinkage long sys_get_mempolicy(int *policy,
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
/* The other functions are compatible */ /* The other functions are compatible */
asmlinkage long compat_get_mempolicy(int *policy, asmlinkage long compat_get_mempolicy(int __user *policy,
unsigned *nmask, unsigned maxnode, unsigned __user *nmask, unsigned maxnode,
unsigned addr, unsigned flags) unsigned addr, unsigned flags)
{ {
long err; long err;
unsigned long *nm = NULL; unsigned long __user *nm = NULL;
if (nmask) if (nmask)
nm = compat_alloc_user_space(ALIGN(maxnode-1, 64) / 8); nm = compat_alloc_user_space(ALIGN(maxnode-1, 64) / 8);
err = sys_get_mempolicy(policy, nm, maxnode, addr, flags); err = sys_get_mempolicy(policy, nm, maxnode, addr, flags);
...@@ -756,7 +757,7 @@ int __mpol_equal(struct mempolicy *a, struct mempolicy *b) ...@@ -756,7 +757,7 @@ int __mpol_equal(struct mempolicy *a, struct mempolicy *b)
} }
/* Slow path of a mpol destructor. */ /* 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)) if (!atomic_dec_and_test(&p->refcnt))
return; return;
......
...@@ -124,7 +124,7 @@ asmlinkage long sys_mincore(unsigned long start, size_t len, ...@@ -124,7 +124,7 @@ asmlinkage long sys_mincore(unsigned long start, size_t len,
goto out; goto out;
error = -EFAULT; error = -EFAULT;
if (!access_ok(VERIFY_WRITE, (unsigned long) vec, len >> PAGE_SHIFT)) if (!access_ok(VERIFY_WRITE, vec, len >> PAGE_SHIFT))
goto out; goto out;
error = 0; error = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment