From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 369BAC432BE for ; Mon, 26 Jul 2021 12:57:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 174D560EB2 for ; Mon, 26 Jul 2021 12:57:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234232AbhGZMRW (ORCPT ); Mon, 26 Jul 2021 08:17:22 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:59777 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234072AbhGZMRV (ORCPT ); Mon, 26 Jul 2021 08:17:21 -0400 Received: from mail-wr1-f42.google.com ([209.85.221.42]) by mrelayeu.kundenserver.de (mreue109 [213.165.67.113]) with ESMTPSA (Nemesis) id 1N6srB-1l0KEl43P5-018Hya; Mon, 26 Jul 2021 14:57:49 +0200 Received: by mail-wr1-f42.google.com with SMTP id h14so3014664wrx.10; Mon, 26 Jul 2021 05:57:48 -0700 (PDT) X-Gm-Message-State: AOAM533lSHAA2y0GYbJqhTZ9utSPIGOkdWSj4XtxeOQJYjXgAMwkqrIx Lx3lvPyOuo1sdRXshuW3dPx11grubYtigpFlzG4= X-Google-Smtp-Source: ABdhPJwCfqbh7SY1HczIHQboW40+xF1z3TRH8jhjG6PiC5glUphKKnEg3U09bKgxsDvY0zlQmQg+heF0MWWUIFL0iWs= X-Received: by 2002:adf:f7c5:: with SMTP id a5mr468847wrq.99.1627304268605; Mon, 26 Jul 2021 05:57:48 -0700 (PDT) MIME-Version: 1.0 References: <20210724162429.394792-1-sven@narfation.org> In-Reply-To: From: Arnd Bergmann Date: Mon, 26 Jul 2021 14:57:31 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] asm-generic: avoid sparse {get,put}_unaligned warning To: Al Viro Cc: Sven Eckelmann , Arnd Bergmann , b.a.t.m.a.n@lists.open-mesh.org, linux-arch , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" X-Provags-ID: V03:K1:fKJECek9OzzLHyjtdZnLzqAe/msTkAvsG4KDqe7E13ALYvUfr8S 70Kaj2gWidd0g5LYqs3JckproBYRYL0Vr+z2eG1zqR4GEH4rH5fsFt9KMZWxqUS0a2isrcQ tniZyDpvsjVntX2OsegXAliet0h+LqLZ2BefyDgr55d/Iudyc7WFhNn+Ya8a3syA38/VCqZ JZ16U72/k9BpQrrzjIcWw== X-UI-Out-Filterresults: notjunk:1;V03:K0:q+LjeDyzOg4=:p0RW/tu0iWGTeRznCgL0gb TxffZtg0XV4ci5CuLweAF4L7Xepa2H1D8voJYQRGTiLIEWHCHWD9+N2wkYu+TWaGZOIsMkb8e f0Cd/b550lK7kjwgsvDU7h8PlBjvuiqPb5e2KJ3EL92raNrFQ6Y9c8PR8QewLbjBCH5y1+Nfp AZYSqeAmctPmJ7joj2eCWl7Ohh+2u74FgfLRYlUp7JpVcs+5b//tcgy2EGSshLdP+DDmPfUdV iMZOwaCKoFGp1WOWwG9zBVe0WU2jjhZYsf+6GCF+O7AvMGna7qr4HCWKxHR9c27WXAkfFcPN1 2PG7mGooXWSe0REp1iBi2++JMeZlrOe8c4z/9AfEbFTnpFpliGC4kBc6fAL11EvGhPJxrcdNe b+LnuISsmOni3h7Hstiu+lMsMhI04Wk8V1NxaILuerwuzW/PVvD01aNpcG1LCxqLr+oqqZqmq bwbqiGszWT1jWez8qrP/YENKygU1+Et9XliVXBtNbPrUMXyMqFs5IH6F3OnfXwiyg6Py5+gWx UHsgjnZjStL28adk44TGQVIviVYi4CtdmGqPLYhLI1MWJMpyqS1Hm1m4yAIF1gXrtLz/tsWEG b1CLhnYOoGikhmLVQwhaFka/7ynHWg4ZN0Yl4WvHMcB5atLKCur83t5zAiB+maF7tNu9Y2GKx cavJAK4EUpYtnUXriOk/nrOgy/nKDwgH+Se4l8AvayR8hVwATBW20LnrZXK6mnvMoGwl2VqRE NMK3rbtfB6Or4KMclBBs4t32riFN4h1liZq1WcPVf2s31PQXwbeQK4z4Nrakc6xwA2zeBEPeV 2F6xKDyZ7wG7yDP4ZwFP/lEB2Lwo8hr2p3KwW24c1kU0gQSG17qsQwSEMBXEHmYVN3H2Mg2 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jul 24, 2021 at 7:01 PM Al Viro 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