Re: [PATCH] asm-generic headers: add arch-specific __strnlen_user calling in uaccess.h

From: Arnd Bergmann
Date: Tue Jan 11 2011 - 10:49:26 EST


On Tuesday 11 January 2011, Guan Xuetao wrote:
> diff --git a/include/asm-generic/uaccess.h b/include/asm-generic/uaccess.h
> index b218b85..ac68c99 100644
> --- a/include/asm-generic/uaccess.h
> +++ b/include/asm-generic/uaccess.h
> @@ -288,14 +288,16 @@ strncpy_from_user(char *dst, const char __user *src, long count)
> *
> * Return 0 on exception, a value greater than N if too long
> */
> -#ifndef strnlen_user
> +#ifndef __strnlen_user
> +#define __strnlen_user strnlen
> +#endif
> +
> static inline long strnlen_user(const char __user *src, long n)
> {
> if (!access_ok(VERIFY_READ, src, 1))
> return 0;
> - return strlen((void * __force)src) + 1;
> + return __strnlen_user(src, n);
> }
> -#endif
>
> static inline long strlen_user(const char __user *src)

Yes, looks good. I believe no architecture currently uses the generic
uaccess.h file directly, so it's not surprising that you find problems
like this in it.

Reviewed-by: Arnd Bergmann <arnd@xxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/