lkml.org 
[lkml]   [2021]   [Jul]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    Date
    SubjectRe: [PATCH] asm-generic: avoid sparse {get,put}_unaligned warning
    On Sat, Jul 24, 2021 at 7:01 PM Al Viro <viro@zeniv.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

    \
     
     \ /
      Last update: 2021-07-26 14:59    [W:2.824 / U:0.016 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site