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
c1aad8dc
Commit
c1aad8dc
authored
Mar 28, 2017
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
asm-generic: zero in __get_user(), not __get_user_fn()
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
3fb50075
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
12 deletions
+6
-12
include/asm-generic/uaccess.h
include/asm-generic/uaccess.h
+6
-12
No files found.
include/asm-generic/uaccess.h
View file @
c1aad8dc
...
...
@@ -86,8 +86,7 @@ static inline int __access_ok(unsigned long addr, unsigned long size)
static
inline
int
__put_user_fn
(
size_t
size
,
void
__user
*
ptr
,
void
*
x
)
{
size
=
__copy_to_user
(
ptr
,
x
,
size
);
return
size
?
-
EFAULT
:
size
;
return
unlikely
(
__copy_to_user
(
ptr
,
x
,
size
))
?
-
EFAULT
:
0
;
}
#define __put_user_fn(sz, u, k) __put_user_fn(sz, u, k)
...
...
@@ -102,28 +101,28 @@ extern int __put_user_bad(void) __attribute__((noreturn));
__chk_user_ptr(ptr); \
switch (sizeof(*(ptr))) { \
case 1: { \
unsigned char __x; \
unsigned char __x
= 0
; \
__gu_err = __get_user_fn(sizeof (*(ptr)), \
ptr, &__x); \
(x) = *(__force __typeof__(*(ptr)) *) &__x; \
break; \
}; \
case 2: { \
unsigned short __x; \
unsigned short __x
= 0
; \
__gu_err = __get_user_fn(sizeof (*(ptr)), \
ptr, &__x); \
(x) = *(__force __typeof__(*(ptr)) *) &__x; \
break; \
}; \
case 4: { \
unsigned int __x; \
unsigned int __x
= 0
; \
__gu_err = __get_user_fn(sizeof (*(ptr)), \
ptr, &__x); \
(x) = *(__force __typeof__(*(ptr)) *) &__x; \
break; \
}; \
case 8: { \
unsigned long long __x
;
\
unsigned long long __x
= 0;
\
__gu_err = __get_user_fn(sizeof (*(ptr)), \
ptr, &__x); \
(x) = *(__force __typeof__(*(ptr)) *) &__x; \
...
...
@@ -148,12 +147,7 @@ extern int __put_user_bad(void) __attribute__((noreturn));
#ifndef __get_user_fn
static
inline
int
__get_user_fn
(
size_t
size
,
const
void
__user
*
ptr
,
void
*
x
)
{
size_t
n
=
__copy_from_user
(
x
,
ptr
,
size
);
if
(
unlikely
(
n
))
{
memset
(
x
+
(
size
-
n
),
0
,
n
);
return
-
EFAULT
;
}
return
0
;
return
unlikely
(
__copy_from_user
(
x
,
ptr
,
size
))
?
-
EFAULT
:
0
;
}
#define __get_user_fn(sz, u, k) __get_user_fn(sz, u, k)
...
...
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