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
Kirill Smelkov
linux
Commits
a7d02afe
Commit
a7d02afe
authored
May 13, 2003
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make x86 user-copy have user pointer annotations to match
declarations.
parent
162132e0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
13 deletions
+15
-13
arch/i386/lib/usercopy.c
arch/i386/lib/usercopy.c
+15
-13
No files found.
arch/i386/lib/usercopy.c
View file @
a7d02afe
...
...
@@ -12,14 +12,16 @@
#include <asm/uaccess.h>
#include <asm/mmx.h>
static
inline
int
movsl_is_ok
(
const
void
*
a1
,
const
void
*
a2
,
unsigned
long
n
)
static
inline
int
__movsl_is_ok
(
unsigned
long
a1
,
unsigned
long
a2
,
unsigned
long
n
)
{
#ifdef CONFIG_X86_INTEL_USERCOPY
if
(
n
>=
64
&&
((
(
const
long
)
a1
^
(
const
long
)
a2
)
&
movsl_mask
.
mask
))
if
(
n
>=
64
&&
((
a1
^
a2
)
&
movsl_mask
.
mask
))
return
0
;
#endif
return
1
;
}
#define movsl_is_ok(a1,a2,n) \
__movsl_is_ok((unsigned long)(a1),(unsigned long)(a2),(n))
/*
* Copy a null terminated string from userspace.
...
...
@@ -74,7 +76,7 @@ do { \
* and returns @count.
*/
long
__strncpy_from_user
(
char
*
dst
,
const
char
*
src
,
long
count
)
__strncpy_from_user
(
char
*
dst
,
const
char
__user
*
src
,
long
count
)
{
long
res
;
__do_strncpy_from_user
(
dst
,
src
,
count
,
res
);
...
...
@@ -100,7 +102,7 @@ __strncpy_from_user(char *dst, const char *src, long count)
* and returns @count.
*/
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
;
if
(
access_ok
(
VERIFY_READ
,
src
,
1
))
...
...
@@ -145,7 +147,7 @@ do { \
* On success, this will be zero.
*/
unsigned
long
clear_user
(
void
*
to
,
unsigned
long
n
)
clear_user
(
void
__user
*
to
,
unsigned
long
n
)
{
if
(
access_ok
(
VERIFY_WRITE
,
to
,
n
))
__do_clear_user
(
to
,
n
);
...
...
@@ -164,7 +166,7 @@ clear_user(void *to, unsigned long n)
* On success, this will be zero.
*/
unsigned
long
__clear_user
(
void
*
to
,
unsigned
long
n
)
__clear_user
(
void
__user
*
to
,
unsigned
long
n
)
{
__do_clear_user
(
to
,
n
);
return
n
;
...
...
@@ -181,7 +183,7 @@ __clear_user(void *to, unsigned long n)
* On exception, returns 0.
* If the string is too long, returns a value greater than @n.
*/
long
strnlen_user
(
const
char
*
s
,
long
n
)
long
strnlen_user
(
const
char
__user
*
s
,
long
n
)
{
unsigned
long
mask
=
-
__addr_ok
(
s
);
unsigned
long
res
,
tmp
;
...
...
@@ -484,7 +486,7 @@ do { \
} while (0)
unsigned
long
__copy_to_user_ll
(
void
*
to
,
const
void
*
from
,
unsigned
long
n
)
unsigned
long
__copy_to_user_ll
(
void
__user
*
to
,
const
void
*
from
,
unsigned
long
n
)
{
#ifndef CONFIG_X86_WP_WORKS_OK
if
(
unlikely
(
boot_cpu_data
.
wp_works_ok
==
0
)
&&
...
...
@@ -534,17 +536,17 @@ unsigned long __copy_to_user_ll(void *to, const void *from, unsigned long n)
}
#endif
if
(
movsl_is_ok
(
to
,
from
,
n
))
__copy_user
(
to
,
from
,
n
);
__copy_user
(
(
void
*
)
to
,
from
,
n
);
else
n
=
__copy_user_intel
(
to
,
from
,
n
);
n
=
__copy_user_intel
(
(
void
*
)
to
,
from
,
n
);
return
n
;
}
unsigned
long
__copy_from_user_ll
(
void
*
to
,
const
void
*
from
,
unsigned
long
n
)
unsigned
long
__copy_from_user_ll
(
void
*
to
,
const
void
__user
*
from
,
unsigned
long
n
)
{
if
(
movsl_is_ok
(
to
,
from
,
n
))
__copy_user_zeroing
(
to
,
from
,
n
);
__copy_user_zeroing
(
to
,
(
const
void
*
)
from
,
n
);
else
n
=
__copy_user_zeroing_intel
(
to
,
from
,
n
);
n
=
__copy_user_zeroing_intel
(
to
,
(
const
void
*
)
from
,
n
);
return
n
;
}
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