Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
c4787237
Commit
c4787237
authored
May 28, 2004
by
Alexander Viro
Committed by
Linus Torvalds
May 28, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] sparse: partial mm/* __user annotation
parent
20158e4d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
13 deletions
+14
-13
mm/mempolicy.c
mm/mempolicy.c
+13
-12
mm/mincore.c
mm/mincore.c
+1
-1
No files found.
mm/mempolicy.c
View file @
c4787237
...
@@ -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
;
...
...
mm/mincore.c
View file @
c4787237
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment