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)
}
/* 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;
......
......@@ -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;
......
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