summaryrefslogtreecommitdiffstats
path: root/arch/x86_64/lib/usercopy.c
diff options
context:
space:
mode:
authorJan Beulich2006-01-11 22:46:48 +0100
committerLinus Torvalds2006-01-12 04:05:03 +0100
commit5f1d189f8a87930d62c507800a8ac20b9a185e41 (patch)
treef83f756d8481dafe3b8ddba5b741ec6b5cf33e96 /arch/x86_64/lib/usercopy.c
parent[PATCH] x86_64: Reduce screen space needed by stack trace (diff)
downloadkernel-qcow2-linux-5f1d189f8a87930d62c507800a8ac20b9a185e41.tar.gz
kernel-qcow2-linux-5f1d189f8a87930d62c507800a8ac20b9a185e41.tar.xz
kernel-qcow2-linux-5f1d189f8a87930d62c507800a8ac20b9a185e41.zip
[PATCH] x86_64: Display meaningful part of filename during BUG()
When building in a separate objtree, file names produced by BUG() & Co. can get fairly long; printing only the first 50 characters may thus result in (almost) no useful information. The following change makes it so that rather the last 50 characters of the filename get printed. Signed-Off-By: Jan Beulich <jbeulich@novell.com> Signed-off-by: Andi Kleen <ak@suse.de> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/x86_64/lib/usercopy.c')
-rw-r--r--arch/x86_64/lib/usercopy.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/arch/x86_64/lib/usercopy.c b/arch/x86_64/lib/usercopy.c
index db8abba1ad81..9bc2c295818e 100644
--- a/arch/x86_64/lib/usercopy.c
+++ b/arch/x86_64/lib/usercopy.c
@@ -109,14 +109,11 @@ unsigned long clear_user(void __user *to, unsigned long n)
* Return 0 on exception, a value greater than N if too long
*/
-long strnlen_user(const char __user *s, long n)
+long __strnlen_user(const char __user *s, long n)
{
long res = 0;
char c;
- if (!access_ok(VERIFY_READ, s, n))
- return 0;
-
while (1) {
if (res>n)
return n+1;
@@ -129,6 +126,13 @@ long strnlen_user(const char __user *s, long n)
}
}
+long strnlen_user(const char __user *s, long n)
+{
+ if (!access_ok(VERIFY_READ, s, n))
+ return 0;
+ return __strnlen_user(s, n);
+}
+
long strlen_user(const char __user *s)
{
long res = 0;