Re: 2.2.13-pre6 build failed (gcc-2.95.1)

Ivan Kokshaysky (ink@jurassic.park.msu.ru)
Mon, 13 Sep 1999 14:26:02 +0400


On Sun, Sep 12, 1999 at 08:16:29PM -0400, Horst von Brand wrote:
> BTW, the function definition itself bothers me a lot: it is called
> strnlen_user; but doesn't return the string's length, but its size; or some
> weird values that signal various errors. I'd clean it up to return a string
> length (I can see the unending patches "fixing" the uses assuming it
> returns a proper length...), -EFAULT for bad addresses, or -E2BIG (?) for
> strings that are too long.

Meanwhile, this patch would make all versions of gcc happy.

Ivan.

--- linux-2.2.13ac7/arch/i386/lib/usercopy.c Mon Sep 13 14:10:43 1999
+++ linux/arch/i386/lib/usercopy.c Mon Sep 13 14:12:13 1999
@@ -123,7 +123,7 @@
long strnlen_user(const char *s, long n)
{
unsigned long mask = -__addr_ok(s);
- unsigned long res;
+ unsigned long res, tmp;

__asm__ __volatile__(
" andl %0,%%ecx\n"
@@ -140,8 +140,8 @@
" .align 4\n"
" .long 0b,2b\n"
".previous"
- :"=r" (n), "=D" (s), "=a" (res)
+ :"=r" (n), "=D" (s), "=a" (res), "=c" (tmp)
:"0" (n), "1" (s), "2" (0), "c" (mask)
- :"cx", "cc");
+ :"cc");
return res & mask;
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/