hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/lib/strnlen_user.c
....@@ -3,15 +3,9 @@
33 #include <linux/export.h>
44 #include <linux/uaccess.h>
55 #include <linux/mm.h>
6
+#include <linux/bitops.h>
67
78 #include <asm/word-at-a-time.h>
8
-
9
-/* Set bits in the first 'n' bytes when loaded from memory */
10
-#ifdef __LITTLE_ENDIAN
11
-# define aligned_byte_mask(n) ((1ul << 8*(n))-1)
12
-#else
13
-# define aligned_byte_mask(n) (~0xfful << (BITS_PER_LONG - 8 - 8*(n)))
14
-#endif
159
1610 /*
1711 * Do a strnlen, return length of string *with* final '\0'.
....@@ -115,9 +109,9 @@
115109 if (max > count)
116110 max = count;
117111
118
- if (user_access_begin(VERIFY_READ, str, max)) {
112
+ if (user_read_access_begin(str, max)) {
119113 retval = do_strnlen_user(str, count, max);
120
- user_access_end();
114
+ user_read_access_end();
121115 return retval;
122116 }
123117 }