X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=lib%2Fstrnlen_user.c;h=6c0005d5dd5c43e7ed4097c24d5fc785a794110e;hb=7e8edae39fd1f880f098612c991cf6d0f646c20d;hp=7f2db3fe311fdd49613912174b69e952413fa1a8;hpb=0ac072cced08390b9b31fe3c56c364c3ef2f6d6a;p=linux-2.6-block.git diff --git a/lib/strnlen_user.c b/lib/strnlen_user.c index 7f2db3fe311f..6c0005d5dd5c 100644 --- a/lib/strnlen_user.c +++ b/lib/strnlen_user.c @@ -2,16 +2,11 @@ #include #include #include +#include +#include #include -/* 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'. * 'count' is the user-supplied count, while 'max' is the @@ -109,7 +104,7 @@ long strnlen_user(const char __user *str, long count) return 0; max_addr = user_addr_max(); - src_addr = (unsigned long)str; + src_addr = (unsigned long)untagged_addr(str); if (likely(src_addr < max_addr)) { unsigned long max = max_addr - src_addr; long retval;