From: Al Viro <viro@zeniv.linux.org.uk>
To: kernel test robot <lkp@intel.com>
Cc: "Eric Dumazet" <edumazet@google.com>,
oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
"Jakub Kicinski" <kuba@kernel.org>,
"Maciej Żenczykowski" <maze@google.com>,
"Will Deacon" <will@kernel.org>,
"Paul E. McKenney" <paulmck@kernel.org>,
"Peter Zijlstra" <peterz@infradead.org>
Subject: Re: include/net/sock.h:2100:16: sparse: sparse: cast to non-scalar
Date: Sat, 10 Jan 2026 22:35:48 +0000 [thread overview]
Message-ID: <20260110223548.GA4041651@ZenIV> (raw)
In-Reply-To: <20260110221508.GF3634291@ZenIV>
On Sat, Jan 10, 2026 at 10:15:09PM +0000, Al Viro wrote:
> On Sun, Jan 11, 2026 at 05:06:31AM +0800, kernel test robot wrote:
>
> Folks, could your bot be taught to recognize that kind of situation?
> It's very clear what's going on - an inline function that gets the
> same warning with this config every time it is called. Commit in
> question has added several calls of that thing; the origin of warning
> has nothing whatsoever to do with it, and that can be guessed without
> even looking at the source - the quoted diff between the logs is quite
> enough for that.
>
> Looking at the function in question,
[accidentally sent halfway through editing, sorry]
e84a4927a404f (Eric Dumazet 2025-06-20 13:30:00 +0000 2097) static inline kuid_t sk_uid(const struct sock *sk)
e84a4927a404f (Eric Dumazet 2025-06-20 13:30:00 +0000 2098) {
e84a4927a404f (Eric Dumazet 2025-06-20 13:30:00 +0000 2099) /* Paired with WRITE_ONCE() in sockfs_setattr() */
e84a4927a404f (Eric Dumazet 2025-06-20 13:30:00 +0000 2100) return READ_ONCE(sk->sk_uid);
e84a4927a404f (Eric Dumazet 2025-06-20 13:30:00 +0000 2101) }
we see that warning in question almost certainly comes from
READ_ONCE(some_kuid_t_object)
and looking at alpha we see this:
#define __READ_ONCE(x) \
({ \
__unqual_scalar_typeof(x) __x = \
(*(volatile typeof(__x) *)(&(x))); \
mb(); \
(typeof(x))__x; \
})
combined with
typedef struct {
uid_t val;
} kuid_t;
IOW, it complains about a cast from structure to itself, which is fair
enough - C is pretty clear about not allowing any typecasts to or from
non-scalar types, tautological or not.
Why do we even need that cast? Seeing that generic __READ_ONCE() is
#define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
the cast added on alpha seems to be pointless.
Folks involved in putting that cast in arch/alpha/include/asm/rwonce.h Cc'd...
next prev parent reply other threads:[~2026-01-10 22:34 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-10 21:06 include/net/sock.h:2100:16: sparse: sparse: cast to non-scalar kernel test robot
2026-01-10 22:15 ` Al Viro
2026-01-10 22:35 ` Al Viro [this message]
2026-01-11 10:08 ` Eric Dumazet
2026-01-12 12:33 ` Peter Zijlstra
2026-01-11 18:20 ` Al Viro
2026-01-11 18:51 ` Al Viro
2026-01-12 12:37 ` Peter Zijlstra
2026-01-12 15:02 ` Will Deacon
2026-01-12 19:21 ` Al Viro
2026-01-12 21:16 ` Al Viro
2026-01-12 22:39 ` David Laight
2026-01-13 0:28 ` Al Viro
2026-01-12 12:32 ` Peter Zijlstra
2026-01-12 19:30 ` Al Viro
2026-01-13 15:27 ` Peter Zijlstra
2026-01-12 0:49 ` Philip Li
-- strict thread matches above, loose matches on Subject: below --
2025-12-06 10:09 kernel test robot
2025-08-25 4:45 kernel test robot
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=20260110223548.GA4041651@ZenIV \
--to=viro@zeniv.linux.org.uk \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=maze@google.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=will@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.