Merge branch 'regulator-4.21' into regulator-5.0
[linux] / lib / strnlen_user.c
index 60d0bbd..1c1a1b0 100644 (file)
@@ -114,10 +114,11 @@ long strnlen_user(const char __user *str, long count)
                unsigned long max = max_addr - src_addr;
                long retval;
 
-               user_access_begin();
-               retval = do_strnlen_user(str, count, max);
-               user_access_end();
-               return retval;
+               if (user_access_begin(str, max)) {
+                       retval = do_strnlen_user(str, count, max);
+                       user_access_end();
+                       return retval;
+               }
        }
        return 0;
 }