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
fc6d1790
Commit
fc6d1790
authored
May 12, 2003
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add user pointer annotations to mtrr driver.
parent
d62a3dd4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
14 deletions
+15
-14
arch/i386/kernel/cpu/mtrr/if.c
arch/i386/kernel/cpu/mtrr/if.c
+15
-14
No files found.
arch/i386/kernel/cpu/mtrr/if.c
View file @
fc6d1790
...
...
@@ -70,7 +70,7 @@ mtrr_file_del(unsigned long base, unsigned long size,
/* RED-PEN: seq_file can seek now. this is ignored. */
static
ssize_t
mtrr_write
(
struct
file
*
file
,
const
char
*
buf
,
size_t
len
,
loff_t
*
ppos
)
mtrr_write
(
struct
file
*
file
,
const
char
__user
*
buf
,
size_t
len
,
loff_t
*
ppos
)
/* Format of control line:
"base=%Lx size=%Lx type=%s" OR:
"disable=%d"
...
...
@@ -133,12 +133,13 @@ mtrr_write(struct file *file, const char *buf, size_t len, loff_t * ppos)
static
int
mtrr_ioctl
(
struct
inode
*
inode
,
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
)
unsigned
int
cmd
,
unsigned
long
__
arg
)
{
int
err
;
mtrr_type
type
;
struct
mtrr_sentry
sentry
;
struct
mtrr_gentry
gentry
;
void
__user
*
arg
=
(
void
__user
*
)
__arg
;
switch
(
cmd
)
{
default:
...
...
@@ -146,7 +147,7 @@ mtrr_ioctl(struct inode *inode, struct file *file,
case
MTRRIOC_ADD_ENTRY
:
if
(
!
capable
(
CAP_SYS_ADMIN
))
return
-
EPERM
;
if
(
copy_from_user
(
&
sentry
,
(
void
*
)
arg
,
sizeof
sentry
))
if
(
copy_from_user
(
&
sentry
,
arg
,
sizeof
sentry
))
return
-
EFAULT
;
err
=
mtrr_file_add
(
sentry
.
base
,
sentry
.
size
,
sentry
.
type
,
1
,
...
...
@@ -157,7 +158,7 @@ mtrr_ioctl(struct inode *inode, struct file *file,
case
MTRRIOC_SET_ENTRY
:
if
(
!
capable
(
CAP_SYS_ADMIN
))
return
-
EPERM
;
if
(
copy_from_user
(
&
sentry
,
(
void
*
)
arg
,
sizeof
sentry
))
if
(
copy_from_user
(
&
sentry
,
arg
,
sizeof
sentry
))
return
-
EFAULT
;
err
=
mtrr_add
(
sentry
.
base
,
sentry
.
size
,
sentry
.
type
,
0
);
if
(
err
<
0
)
...
...
@@ -166,7 +167,7 @@ mtrr_ioctl(struct inode *inode, struct file *file,
case
MTRRIOC_DEL_ENTRY
:
if
(
!
capable
(
CAP_SYS_ADMIN
))
return
-
EPERM
;
if
(
copy_from_user
(
&
sentry
,
(
void
*
)
arg
,
sizeof
sentry
))
if
(
copy_from_user
(
&
sentry
,
arg
,
sizeof
sentry
))
return
-
EFAULT
;
err
=
mtrr_file_del
(
sentry
.
base
,
sentry
.
size
,
file
,
0
);
if
(
err
<
0
)
...
...
@@ -175,14 +176,14 @@ mtrr_ioctl(struct inode *inode, struct file *file,
case
MTRRIOC_KILL_ENTRY
:
if
(
!
capable
(
CAP_SYS_ADMIN
))
return
-
EPERM
;
if
(
copy_from_user
(
&
sentry
,
(
void
*
)
arg
,
sizeof
sentry
))
if
(
copy_from_user
(
&
sentry
,
arg
,
sizeof
sentry
))
return
-
EFAULT
;
err
=
mtrr_del
(
-
1
,
sentry
.
base
,
sentry
.
size
);
if
(
err
<
0
)
return
err
;
break
;
case
MTRRIOC_GET_ENTRY
:
if
(
copy_from_user
(
&
gentry
,
(
void
*
)
arg
,
sizeof
gentry
))
if
(
copy_from_user
(
&
gentry
,
arg
,
sizeof
gentry
))
return
-
EFAULT
;
if
(
gentry
.
regnum
>=
num_var_ranges
)
return
-
EINVAL
;
...
...
@@ -198,13 +199,13 @@ mtrr_ioctl(struct inode *inode, struct file *file,
gentry
.
type
=
type
;
}
if
(
copy_to_user
(
(
void
*
)
arg
,
&
gentry
,
sizeof
gentry
))
if
(
copy_to_user
(
arg
,
&
gentry
,
sizeof
gentry
))
return
-
EFAULT
;
break
;
case
MTRRIOC_ADD_PAGE_ENTRY
:
if
(
!
capable
(
CAP_SYS_ADMIN
))
return
-
EPERM
;
if
(
copy_from_user
(
&
sentry
,
(
void
*
)
arg
,
sizeof
sentry
))
if
(
copy_from_user
(
&
sentry
,
arg
,
sizeof
sentry
))
return
-
EFAULT
;
err
=
mtrr_file_add
(
sentry
.
base
,
sentry
.
size
,
sentry
.
type
,
1
,
...
...
@@ -215,7 +216,7 @@ mtrr_ioctl(struct inode *inode, struct file *file,
case
MTRRIOC_SET_PAGE_ENTRY
:
if
(
!
capable
(
CAP_SYS_ADMIN
))
return
-
EPERM
;
if
(
copy_from_user
(
&
sentry
,
(
void
*
)
arg
,
sizeof
sentry
))
if
(
copy_from_user
(
&
sentry
,
arg
,
sizeof
sentry
))
return
-
EFAULT
;
err
=
mtrr_add_page
(
sentry
.
base
,
sentry
.
size
,
sentry
.
type
,
0
);
if
(
err
<
0
)
...
...
@@ -224,7 +225,7 @@ mtrr_ioctl(struct inode *inode, struct file *file,
case
MTRRIOC_DEL_PAGE_ENTRY
:
if
(
!
capable
(
CAP_SYS_ADMIN
))
return
-
EPERM
;
if
(
copy_from_user
(
&
sentry
,
(
void
*
)
arg
,
sizeof
sentry
))
if
(
copy_from_user
(
&
sentry
,
arg
,
sizeof
sentry
))
return
-
EFAULT
;
err
=
mtrr_file_del
(
sentry
.
base
,
sentry
.
size
,
file
,
1
);
if
(
err
<
0
)
...
...
@@ -233,21 +234,21 @@ mtrr_ioctl(struct inode *inode, struct file *file,
case
MTRRIOC_KILL_PAGE_ENTRY
:
if
(
!
capable
(
CAP_SYS_ADMIN
))
return
-
EPERM
;
if
(
copy_from_user
(
&
sentry
,
(
void
*
)
arg
,
sizeof
sentry
))
if
(
copy_from_user
(
&
sentry
,
arg
,
sizeof
sentry
))
return
-
EFAULT
;
err
=
mtrr_del_page
(
-
1
,
sentry
.
base
,
sentry
.
size
);
if
(
err
<
0
)
return
err
;
break
;
case
MTRRIOC_GET_PAGE_ENTRY
:
if
(
copy_from_user
(
&
gentry
,
(
void
*
)
arg
,
sizeof
gentry
))
if
(
copy_from_user
(
&
gentry
,
arg
,
sizeof
gentry
))
return
-
EFAULT
;
if
(
gentry
.
regnum
>=
num_var_ranges
)
return
-
EINVAL
;
mtrr_if
->
get
(
gentry
.
regnum
,
&
gentry
.
base
,
&
gentry
.
size
,
&
type
);
gentry
.
type
=
type
;
if
(
copy_to_user
(
(
void
*
)
arg
,
&
gentry
,
sizeof
gentry
))
if
(
copy_to_user
(
arg
,
&
gentry
,
sizeof
gentry
))
return
-
EFAULT
;
break
;
}
...
...
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