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
18e2ea5c
Commit
18e2ea5c
authored
Dec 29, 2017
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
uvc_v4l2: clean copyin/copyout up
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
14544d76
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
33 deletions
+22
-33
drivers/media/usb/uvc/uvc_v4l2.c
drivers/media/usb/uvc/uvc_v4l2.c
+22
-33
No files found.
drivers/media/usb/uvc/uvc_v4l2.c
View file @
18e2ea5c
...
...
@@ -1284,36 +1284,30 @@ struct uvc_xu_control_mapping32 {
static
int
uvc_v4l2_get_xu_mapping
(
struct
uvc_xu_control_mapping
*
kp
,
const
struct
uvc_xu_control_mapping32
__user
*
up
)
{
compat_caddr_t
p
;
struct
uvc_xu_control_mapping32
*
p
=
(
void
*
)
kp
;
compat_caddr_t
info
;
u32
count
;
if
(
!
access_ok
(
VERIFY_READ
,
up
,
sizeof
(
*
up
))
||
__copy_from_user
(
kp
,
up
,
offsetof
(
typeof
(
*
up
),
menu_info
))
||
__get_user
(
kp
->
menu_count
,
&
up
->
menu_count
))
if
(
copy_from_user
(
p
,
up
,
sizeof
(
*
p
)))
return
-
EFAULT
;
memset
(
kp
->
reserved
,
0
,
sizeof
(
kp
->
reserved
));
if
(
kp
->
menu_count
==
0
)
{
kp
->
menu_info
=
NULL
;
return
0
;
}
if
(
__get_user
(
p
,
&
up
->
menu_info
))
return
-
EFAULT
;
kp
->
menu_info
=
compat_ptr
(
p
);
count
=
p
->
menu_count
;
info
=
p
->
menu_info
;
memset
(
kp
->
reserved
,
0
,
sizeof
(
kp
->
reserved
));
kp
->
menu_info
=
count
?
compat_ptr
(
info
)
:
NULL
;
kp
->
menu_count
=
count
;
return
0
;
}
static
int
uvc_v4l2_put_xu_mapping
(
const
struct
uvc_xu_control_mapping
*
kp
,
struct
uvc_xu_control_mapping32
__user
*
up
)
{
if
(
!
access_ok
(
VERIFY_WRITE
,
up
,
sizeof
(
*
up
))
||
__copy_to_user
(
up
,
kp
,
offsetof
(
typeof
(
*
up
),
menu_info
))
||
__put_user
(
kp
->
menu_count
,
&
up
->
menu_count
))
if
(
copy_to_user
(
up
,
kp
,
offsetof
(
typeof
(
*
up
),
menu_info
))
||
put_user
(
kp
->
menu_count
,
&
up
->
menu_count
))
return
-
EFAULT
;
if
(
__
clear_user
(
up
->
reserved
,
sizeof
(
up
->
reserved
)))
if
(
clear_user
(
up
->
reserved
,
sizeof
(
up
->
reserved
)))
return
-
EFAULT
;
return
0
;
...
...
@@ -1330,31 +1324,26 @@ struct uvc_xu_control_query32 {
static
int
uvc_v4l2_get_xu_query
(
struct
uvc_xu_control_query
*
kp
,
const
struct
uvc_xu_control_query32
__user
*
up
)
{
compat_caddr_t
p
;
struct
uvc_xu_control_query32
v
;
if
(
!
access_ok
(
VERIFY_READ
,
up
,
sizeof
(
*
up
))
||
__copy_from_user
(
kp
,
up
,
offsetof
(
typeof
(
*
up
),
data
)))
if
(
copy_from_user
(
&
v
,
up
,
sizeof
(
v
)))
return
-
EFAULT
;
if
(
kp
->
size
==
0
)
{
kp
->
data
=
NULL
;
return
0
;
}
if
(
__get_user
(
p
,
&
up
->
data
))
return
-
EFAULT
;
kp
->
data
=
compat_ptr
(
p
);
*
kp
=
(
struct
uvc_xu_control_query
){
.
unit
=
v
.
unit
,
.
selector
=
v
.
selector
,
.
query
=
v
.
query
,
.
size
=
v
.
size
,
.
data
=
v
.
size
?
compat_ptr
(
v
.
data
)
:
NULL
};
return
0
;
}
static
int
uvc_v4l2_put_xu_query
(
const
struct
uvc_xu_control_query
*
kp
,
struct
uvc_xu_control_query32
__user
*
up
)
{
if
(
!
access_ok
(
VERIFY_WRITE
,
up
,
sizeof
(
*
up
))
||
__copy_to_user
(
up
,
kp
,
offsetof
(
typeof
(
*
up
),
data
)))
if
(
copy_to_user
(
up
,
kp
,
offsetof
(
typeof
(
*
up
),
data
)))
return
-
EFAULT
;
return
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