patch-2.1.11 linux/include/asm-alpha/uaccess.h
Next file: linux/include/asm-alpha/unistd.h
Previous file: linux/drivers/scsi/scsi.c
Back to the patch index
Back to the overall index
- Lines: 35
- Date:
Fri Nov 15 22:36:52 1996
- Orig file:
v2.1.10/linux/include/asm-alpha/uaccess.h
- Orig date:
Fri Nov 15 23:49:10 1996
diff -u --recursive --new-file v2.1.10/linux/include/asm-alpha/uaccess.h linux/include/asm-alpha/uaccess.h
@@ -377,14 +377,14 @@
extern long __strncpy_from_user(char *__to, const char *__from, long __to_len);
-#define strncpy_from_user(to,from,n) \
-({ \
- char * __sfu_to = (to); \
- const char * __sfu_from = (from); \
- long __sfu_len = (n), __sfu_ret = -EFAULT; \
- if (__access_ok(((long)__sfu_from),__sfu_len,__access_mask)) \
- __sfu_ret=__strncpy_from_user(__sfu_to,__sfu_from,__sfu_len); \
- __sfu_ret; \
+#define strncpy_from_user(to,from,n) \
+({ \
+ char * __sfu_to = (to); \
+ const char * __sfu_from = (from); \
+ long __sfu_ret = -EFAULT; \
+ if (__access_ok(((long)__sfu_from),0,__access_mask)) \
+ __sfu_ret = __strncpy_from_user(__sfu_to,__sfu_from,(n)); \
+ __sfu_ret; \
})
/* Returns: 0 if bad, string length+1 (memory size) of string if ok */
@@ -392,10 +392,7 @@
extern inline long strlen_user(const char *str)
{
- long len = __strlen_user(str);
- if (!access_ok(VERIFY_READ, str, len))
- len = 0;
- return len;
+ return access_ok(VERIFY_READ,str,0) ? __strlen_user(str) : 0;
}
/*
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov