patch-2.1.10 linux/include/asm-alpha/uaccess.h

Next file: linux/include/asm-i386/bitops.h
Previous file: linux/include/asm-alpha/byteorder.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.9/linux/include/asm-alpha/uaccess.h linux/include/asm-alpha/uaccess.h
@@ -387,6 +387,16 @@
 	__sfu_ret;							      \
 })
 
+/* Returns: 0 if bad, string length+1 (memory size) of string if ok */
+extern long __strlen_user(const char *);
+
+extern inline long strlen_user(const char *str)
+{
+	long len = __strlen_user(str);
+	if (!access_ok(VERIFY_READ, str, len))
+		len = 0;
+	return len;
+}
 
 /*
  * About the exception table:

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov