[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK8P3a2MVQMFFBUzudy+yrcp4Md8mm=NcvX7YzGVz4C8W61sgQ@mail.gmail.com>
Date: Mon, 26 Jul 2021 14:57:31 +0200
From: Arnd Bergmann <arnd@...db.de>
To: Al Viro <viro@...iv.linux.org.uk>
Cc: Sven Eckelmann <sven@...fation.org>, Arnd Bergmann <arnd@...db.de>,
b.a.t.m.a.n@...ts.open-mesh.org,
linux-arch <linux-arch@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] asm-generic: avoid sparse {get,put}_unaligned warning
On Sat, Jul 24, 2021 at 7:01 PM Al Viro <viro@...iv.linux.org.uk> wrote:
>
> On Sat, Jul 24, 2021 at 06:24:29PM +0200, Sven Eckelmann wrote:
>
> > The special attribute force must be used in such statements when the cast
> > is known to be safe to avoid these warnings.
I can see why this would warn, but I'm having trouble reproducing the
warning on linux-next.
> How about container_of(ptr, typeof(*__pptr), x) instead of a cast?
> Would be easier to follow...
If both work equally well, I'd prefer Sven's patch since that only
expands 'type'
once, while container_of() expands it three more times. This may not make
much of a difference, but I've seen a number of cases where nested macros
can explode the preprocessed code size enough to slow down kernel compilation
over all, and it's quite possible to have get_unaligned()/put_unaligned in
the middle of that, with a complex expression passed into that.
Arnd
Powered by blists - more mailing lists