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
00035bee
Commit
00035bee
authored
Apr 26, 2020
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comedi: lift copy_from_user() into callers of __comedi_get_user_cmd()
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
b8d47d88
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
8 deletions
+12
-8
drivers/staging/comedi/comedi_fops.c
drivers/staging/comedi/comedi_fops.c
+12
-8
No files found.
drivers/staging/comedi/comedi_fops.c
View file @
00035bee
...
...
@@ -1649,17 +1649,11 @@ static int do_insn_ioctl(struct comedi_device *dev,
}
static
int
__comedi_get_user_cmd
(
struct
comedi_device
*
dev
,
struct
comedi_cmd
__user
*
arg
,
struct
comedi_cmd
*
cmd
)
{
struct
comedi_subdevice
*
s
;
lockdep_assert_held
(
&
dev
->
mutex
);
if
(
copy_from_user
(
cmd
,
arg
,
sizeof
(
*
cmd
)))
{
dev_dbg
(
dev
->
class_dev
,
"bad cmd address
\n
"
);
return
-
EFAULT
;
}
if
(
cmd
->
subdev
>=
dev
->
n_subdevices
)
{
dev_dbg
(
dev
->
class_dev
,
"%d no such subdevice
\n
"
,
cmd
->
subdev
);
return
-
ENODEV
;
...
...
@@ -1757,8 +1751,13 @@ static int do_cmd_ioctl(struct comedi_device *dev,
lockdep_assert_held
(
&
dev
->
mutex
);
if
(
copy_from_user
(
&
cmd
,
arg
,
sizeof
(
cmd
)))
{
dev_dbg
(
dev
->
class_dev
,
"bad cmd address
\n
"
);
return
-
EFAULT
;
}
/* get the user's cmd and do some simple validation */
ret
=
__comedi_get_user_cmd
(
dev
,
arg
,
&
cmd
);
ret
=
__comedi_get_user_cmd
(
dev
,
&
cmd
);
if
(
ret
)
return
ret
;
...
...
@@ -1866,8 +1865,13 @@ static int do_cmdtest_ioctl(struct comedi_device *dev,
lockdep_assert_held
(
&
dev
->
mutex
);
if
(
copy_from_user
(
&
cmd
,
arg
,
sizeof
(
cmd
)))
{
dev_dbg
(
dev
->
class_dev
,
"bad cmd address
\n
"
);
return
-
EFAULT
;
}
/* get the user's cmd and do some simple validation */
ret
=
__comedi_get_user_cmd
(
dev
,
arg
,
&
cmd
);
ret
=
__comedi_get_user_cmd
(
dev
,
&
cmd
);
if
(
ret
)
return
ret
;
...
...
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