diff options
Diffstat (limited to 'lib/strncpy_from_user.c')
-rw-r--r-- | lib/strncpy_from_user.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/strncpy_from_user.c b/lib/strncpy_from_user.c index b53e1b5d80f4..58eacd41526c 100644 --- a/lib/strncpy_from_user.c +++ b/lib/strncpy_from_user.c | |||
@@ -114,10 +114,11 @@ long strncpy_from_user(char *dst, const char __user *src, long count) | |||
114 | 114 | ||
115 | kasan_check_write(dst, count); | 115 | kasan_check_write(dst, count); |
116 | check_object_size(dst, count, false); | 116 | check_object_size(dst, count, false); |
117 | user_access_begin(); | 117 | if (user_access_begin(src, max)) { |
118 | retval = do_strncpy_from_user(dst, src, count, max); | 118 | retval = do_strncpy_from_user(dst, src, count, max); |
119 | user_access_end(); | 119 | user_access_end(); |
120 | return retval; | 120 | return retval; |
121 | } | ||
121 | } | 122 | } |
122 | return -EFAULT; | 123 | return -EFAULT; |
123 | } | 124 | } |