[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9f763da3-25c6-24e7-91e9-f3016a85f9f7@infradead.org>
Date: Sat, 15 May 2021 11:41:13 -0700
From: Randy Dunlap <rdunlap@...radead.org>
To: Arnd Bergmann <arnd@...nel.org>, linux-arch@...r.kernel.org
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Vineet Gupta <vgupta@...opsys.com>,
Arnd Bergmann <arnd@...db.de>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 12/13] asm-generic: uaccess: 1-byte access is always
aligned
On 5/14/21 3:01 AM, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@...db.de>
>
> With the cleaned up version of asm-generic/unaligned.h,
> there is a warning about the get_user/put_user helpers using
> unaligned access for single-byte variables:
>
> include/asm-generic/uaccess.h: In function ‘__get_user_fn’:
> include/asm-generic/unaligned.h:13:15: warning: ‘packed’ attribute ignored for field of type ‘u8’ {aka ‘unsigned char’} [-Wattributes]
> const struct { type x __packed; } *__pptr = (typeof(__pptr))(ptr); \
>
> Change these to use a direct pointer dereference to avoid the
> warnings.
>
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
> ---
> include/asm-generic/uaccess.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/include/asm-generic/uaccess.h b/include/asm-generic/uaccess.h
> index 4973328f3c6e..7e903e450659 100644
> --- a/include/asm-generic/uaccess.h
> +++ b/include/asm-generic/uaccess.h
> @@ -19,7 +19,7 @@ __get_user_fn(size_t size, const void __user *from, void *to)
>
> switch (size) {
> case 1:
> - *(u8 *)to = get_unaligned((u8 __force *)from);
> + *(u8 *)to = *((u8 __force *)from);
> return 0;
> case 2:
> *(u16 *)to = get_unaligned((u16 __force *)from);
> @@ -45,7 +45,7 @@ __put_user_fn(size_t size, void __user *to, void *from)
>
> switch (size) {
> case 1:
> - put_unaligned(*(u8 *)from, (u8 __force *)to);
> + *(*(u8 *)from, (u8 __force *)to);
Should that be from =
?
> return 0;
> case 2:
> put_unaligned(*(u16 *)from, (u16 __force *)to);
>
--
~Randy
Powered by blists - more mailing lists