diff options
Diffstat (limited to 'lib/strnlen_user.c')
| -rw-r--r-- | lib/strnlen_user.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/strnlen_user.c b/lib/strnlen_user.c index 6c0005d5dd5c..1616710b8a82 100644 --- a/lib/strnlen_user.c +++ b/lib/strnlen_user.c @@ -27,13 +27,6 @@ static inline long do_strnlen_user(const char __user *src, unsigned long count, unsigned long c; /* - * Truncate 'max' to the user-specified limit, so that - * we only have one limit we need to check in the loop - */ - if (max > count) - max = count; - - /* * Do everything aligned. But that means that we * need to also expand the maximum.. */ @@ -109,9 +102,16 @@ long strnlen_user(const char __user *str, long count) unsigned long max = max_addr - src_addr; long retval; - if (user_access_begin(str, max)) { + /* + * Truncate 'max' to the user-specified limit, so that + * we only have one limit we need to check in the loop + */ + if (max > count) + max = count; + + if (user_read_access_begin(str, max)) { retval = do_strnlen_user(str, count, max); - user_access_end(); + user_read_access_end(); return retval; } } |
