* [linux-next:master 4018/13846] drivers/net/tun.c:2375:24: sparse: sparse: cast to non-scalar
@ 2026-08-10 3:32 kernel test robot
2026-08-10 22:22 ` Willem de Bruijn
0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2026-08-10 3:32 UTC (permalink / raw)
To: Eric Dumazet
Cc: oe-kbuild-all, Paolo Abeni, Kuniyuki Iwashima, Willem de Bruijn
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: 6b8c8af514d739d0335f5579b585e02babe8a727
commit: 23dad2d088dfc82cae1f5a936f8ff7ffebb38dd9 [4018/13846] tun: no longer rely on RTNL in tun_fill_info()
config: alpha-randconfig-r134-20260810 (https://download.01.org/0day-ci/archive/20260810/202608101002.AO7X3ZCH-lkp@intel.com/config)
compiler: alpha-linux-gcc (GCC) 14.3.0
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260810/202608101002.AO7X3ZCH-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202608101002.AO7X3ZCH-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
>> drivers/net/tun.c:2375:24: sparse: sparse: cast to non-scalar
>> drivers/net/tun.c:2375:24: sparse: sparse: cast from non-scalar
drivers/net/tun.c:2376:24: sparse: sparse: cast to non-scalar
drivers/net/tun.c:2376:24: sparse: sparse: cast from non-scalar
vim +2375 drivers/net/tun.c
2370
2371 static int tun_fill_info(struct sk_buff *skb, const struct net_device *dev)
2372 {
2373 const struct tun_struct *tun = netdev_priv(dev);
2374 unsigned int flags = READ_ONCE(tun->flags);
> 2375 kuid_t owner = READ_ONCE(tun->owner);
2376 kgid_t group = READ_ONCE(tun->group);
2377
2378 if (nla_put_u8(skb, IFLA_TUN_TYPE, flags & TUN_TYPE_MASK))
2379 goto nla_put_failure;
2380 if (uid_valid(owner) &&
2381 nla_put_u32(skb, IFLA_TUN_OWNER,
2382 from_kuid_munged(current_user_ns(), owner)))
2383 goto nla_put_failure;
2384 if (gid_valid(group) &&
2385 nla_put_u32(skb, IFLA_TUN_GROUP,
2386 from_kgid_munged(current_user_ns(), group)))
2387 goto nla_put_failure;
2388 if (nla_put_u8(skb, IFLA_TUN_PI, !(flags & IFF_NO_PI)))
2389 goto nla_put_failure;
2390 if (nla_put_u8(skb, IFLA_TUN_VNET_HDR, !!(flags & IFF_VNET_HDR)))
2391 goto nla_put_failure;
2392 if (nla_put_u8(skb, IFLA_TUN_PERSIST, !!(flags & IFF_PERSIST)))
2393 goto nla_put_failure;
2394 if (nla_put_u8(skb, IFLA_TUN_MULTI_QUEUE,
2395 !!(flags & IFF_MULTI_QUEUE)))
2396 goto nla_put_failure;
2397 if (flags & IFF_MULTI_QUEUE) {
2398 if (nla_put_u32(skb, IFLA_TUN_NUM_QUEUES,
2399 READ_ONCE(tun->numqueues)))
2400 goto nla_put_failure;
2401 if (nla_put_u32(skb, IFLA_TUN_NUM_DISABLED_QUEUES,
2402 READ_ONCE(tun->numdisabled)))
2403 goto nla_put_failure;
2404 }
2405
2406 return 0;
2407
2408 nla_put_failure:
2409 return -EMSGSIZE;
2410 }
2411
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [linux-next:master 4018/13846] drivers/net/tun.c:2375:24: sparse: sparse: cast to non-scalar
2026-08-10 3:32 [linux-next:master 4018/13846] drivers/net/tun.c:2375:24: sparse: sparse: cast to non-scalar kernel test robot
@ 2026-08-10 22:22 ` Willem de Bruijn
0 siblings, 0 replies; 2+ messages in thread
From: Willem de Bruijn @ 2026-08-10 22:22 UTC (permalink / raw)
To: kernel test robot
Cc: Eric Dumazet, oe-kbuild-all, Paolo Abeni, Kuniyuki Iwashima
On Sun, Aug 9, 2026 at 11:33 PM kernel test robot <lkp@intel.com> wrote:
>
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head: 6b8c8af514d739d0335f5579b585e02babe8a727
> commit: 23dad2d088dfc82cae1f5a936f8ff7ffebb38dd9 [4018/13846] tun: no longer rely on RTNL in tun_fill_info()
> config: alpha-randconfig-r134-20260810 (https://download.01.org/0day-ci/archive/20260810/202608101002.AO7X3ZCH-lkp@intel.com/config)
> compiler: alpha-linux-gcc (GCC) 14.3.0
> sparse: v0.6.5-rc1
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260810/202608101002.AO7X3ZCH-lkp@intel.com/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202608101002.AO7X3ZCH-lkp@intel.com/
>
> sparse warnings: (new ones prefixed by >>)
> >> drivers/net/tun.c:2375:24: sparse: sparse: cast to non-scalar
> >> drivers/net/tun.c:2375:24: sparse: sparse: cast from non-scalar
> drivers/net/tun.c:2376:24: sparse: sparse: cast to non-scalar
> drivers/net/tun.c:2376:24: sparse: sparse: cast from non-scalar
>
> vim +2375 drivers/net/tun.c
>
> 2370
> 2371 static int tun_fill_info(struct sk_buff *skb, const struct net_device *dev)
> 2372 {
> 2373 const struct tun_struct *tun = netdev_priv(dev);
> 2374 unsigned int flags = READ_ONCE(tun->flags);
> > 2375 kuid_t owner = READ_ONCE(tun->owner);
I guess this would need to be owner.val and group.val to silence this
warning. Both from and to arguments.
That approach would not improve readability.
Types:
typedef struct {
uid_t val;
} kuid_t;
typedef struct {
gid_t val;
} kgid_t;
Whatever we choose to do (if anything), probably also applies to sk_uid:
static inline kuid_t sk_uid(const struct sock *sk)
{
/* Paired with WRITE_ONCE() in sockfs_setattr() */
return READ_ONCE(sk->sk_uid);
}
Another helper, make_kuid, uses a KUIDT_INIT wrapper to cast to the struct type.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-08-10 22:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-10 3:32 [linux-next:master 4018/13846] drivers/net/tun.c:2375:24: sparse: sparse: cast to non-scalar kernel test robot
2026-08-10 22:22 ` Willem de Bruijn
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.