linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Johansen <john.johansen@canonical.com>
To: Arnd Bergmann <arnd@kernel.org>, linux-arch@vger.kernel.org
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Vineet Gupta <vgupta@synopsys.com>, Arnd Bergmann <arnd@arndb.de>,
	James Morris <jmorris@namei.org>,
	"Serge E. Hallyn" <serge@hallyn.com>,
	linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC 09/12] apparmor: use get_unaligned() only for multi-byte words
Date: Mon, 10 May 2021 01:17:23 -0700	[thread overview]
Message-ID: <a301b47e-dc27-cdc8-ab93-07816e5dc2e1@canonical.com> (raw)
In-Reply-To: <20210507220813.365382-10-arnd@kernel.org>

On 5/7/21 3:07 PM, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.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@arndb.de>
Acked-by: John Johansen <john.johansen@canonical.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;
>  	}
> 


  reply	other threads:[~2021-05-10  8:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-07 22:07 [RFC 0/12] Unify asm/unaligned.h around struct helper Arnd Bergmann
2021-05-07 22:07 ` [RFC 09/12] apparmor: use get_unaligned() only for multi-byte words Arnd Bergmann
2021-05-10  8:17   ` John Johansen [this message]
2021-05-07 22:07 ` [RFC 0/12] Unify asm/unaligned.h around struct helper Arnd Bergmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a301b47e-dc27-cdc8-ab93-07816e5dc2e1@canonical.com \
    --to=john.johansen@canonical.com \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=jmorris@namei.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=serge@hallyn.com \
    --cc=torvalds@linux-foundation.org \
    --cc=vgupta@synopsys.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).