From 102a0743326a03cd1a1202ceda21e175b7d3575c Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Tue, 20 Feb 2024 01:20:52 +0000
Subject: [PATCH] add new system file

---
 kernel/lib/strnlen_user.c |   12 +++---------
 1 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/kernel/lib/strnlen_user.c b/kernel/lib/strnlen_user.c
index 37628e7..1616710 100644
--- a/kernel/lib/strnlen_user.c
+++ b/kernel/lib/strnlen_user.c
@@ -3,15 +3,9 @@
 #include <linux/export.h>
 #include <linux/uaccess.h>
 #include <linux/mm.h>
+#include <linux/bitops.h>
 
 #include <asm/word-at-a-time.h>
-
-/* Set bits in the first 'n' bytes when loaded from memory */
-#ifdef __LITTLE_ENDIAN
-#  define aligned_byte_mask(n) ((1ul << 8*(n))-1)
-#else
-#  define aligned_byte_mask(n) (~0xfful << (BITS_PER_LONG - 8 - 8*(n)))
-#endif
 
 /*
  * Do a strnlen, return length of string *with* final '\0'.
@@ -115,9 +109,9 @@
 		if (max > count)
 			max = count;
 
-		if (user_access_begin(VERIFY_READ, str, max)) {
+		if (user_read_access_begin(str, max)) {
 			retval = do_strnlen_user(str, count, max);
-			user_access_end();
+			user_read_access_end();
 			return retval;
 		}
 	}

--
Gitblit v1.6.2