[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a301b47e-dc27-cdc8-ab93-07816e5dc2e1@canonical.com>
Date: Mon, 10 May 2021 01:17:23 -0700
From: John Johansen <john.johansen@...onical.com>
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>,
James Morris <jmorris@...ei.org>,
"Serge E. Hallyn" <serge@...lyn.com>,
linux-security-module@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [RFC 09/12] apparmor: use get_unaligned() only for multi-byte
words
On 5/7/21 3:07 PM, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@...db.de>
>
> Using get_unaligned() on a u8 pointer is pointless, and will
> result in a compiler warning after a planned cleanup:
>
> In file included from arch/x86/include/generated/asm/unaligned.h:1,
> from security/apparmor/policy_unpack.c:16:
> security/apparmor/policy_unpack.c: In function 'unpack_u8':
> include/asm-generic/unaligned.h:13:15: error: 'packed' attribute ignored for field of type 'u8' {aka 'unsigned char'} [-Werror=attributes]
> 13 | const struct { type x __packed; } *__pptr = (typeof(__pptr))(ptr); \
> | ^
>
> Simply dereference this pointer directly.
>
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
Acked-by: John Johansen <john.johansen@...onical.com>
> ---
> security/apparmor/policy_unpack.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/security/apparmor/policy_unpack.c b/security/apparmor/policy_unpack.c
> index b8efbda545cb..0acca6f2a93f 100644
> --- a/security/apparmor/policy_unpack.c
> +++ b/security/apparmor/policy_unpack.c
> @@ -304,7 +304,7 @@ static bool unpack_u8(struct aa_ext *e, u8 *data, const char *name)
> if (!inbounds(e, sizeof(u8)))
> goto fail;
> if (data)
> - *data = get_unaligned((u8 *)e->pos);
> + *data = *((u8 *)e->pos);
> e->pos += sizeof(u8);
> return true;
> }
>
Powered by blists - more mailing lists