Re: [PATCH net] igmp: convert struct ip_sf_list to RCU

Eric Dumazet <[email protected]>
Newsgroups dev.linux.lists.oe-kbuild-all,org.kernel.vger.netdev
Message-ID <CANn89iJQci2kNmEEPHmqkw2qE2NXnQCmCPUfow1MjudjCTJXFQ@mail.gmail.com>
On Thu, Aug 27, 2026 at 10:13 AM kernel test robot <[email protected]> wrote:
>
> Hi Eric,
>
> kernel test robot noticed the following build warnings:
>
> [auto build test WARNING on net/main]
>
> url:    https://github.com/intel-lab-lkp/linux/commits/Eric-Dumazet/igmp-convert-struct-ip_sf_list-to-RCU/20260826-115913
> base:   net/main
> patch link:    https://lore.kernel.org/r/20260826115913.3381537-1-edumazet%40google.com
> patch subject: [PATCH net] igmp: convert struct ip_sf_list to RCU
> config: i386-randconfig-062-20260827 (https://download.01.org/0day-ci/archive/20260827/[email protected]/config)
> compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
> sparse: v0.6.5-rc1
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260827/[email protected]/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 <[email protected]>
> | Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
>
> sparse warnings: (new ones prefixed by >>)
>    net/ipv4/igmp.c: note: in included file (through include/linux/igmp.h):
>    include/uapi/linux/igmp.h:60:32: sparse: sparse: array of flexible structures
> >> net/ipv4/igmp.c:3114:13: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct ip_sf_list *psf @@     got struct ip_sf_list [noderef] __rcu *sf_next @@
>    net/ipv4/igmp.c:3114:13: sparse:     expected struct ip_sf_list *psf
>    net/ipv4/igmp.c:3114:13: sparse:     got struct ip_sf_list [noderef] __rcu *sf_next
> >> net/ipv4/igmp.c:3130:21: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct ip_sf_list *psf @@     got struct ip_sf_list [noderef] __rcu *sources @@
>    net/ipv4/igmp.c:3130:21: sparse:     expected struct ip_sf_list *psf
>    net/ipv4/igmp.c:3130:21: sparse:     got struct ip_sf_list [noderef] __rcu *sources
>    net/ipv4/igmp.c:3098:29: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct ip_sf_list *psf @@     got struct ip_sf_list [noderef] __rcu *sources @@
>    net/ipv4/igmp.c:3098:29: sparse:     expected struct ip_sf_list *psf
>    net/ipv4/igmp.c:3098:29: sparse:     got struct ip_sf_list [noderef] __rcu *sources
>    net/ipv4/igmp.c:3098:29: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct ip_sf_list *psf @@     got struct ip_sf_list [noderef] __rcu *sources @@
>    net/ipv4/igmp.c:3098:29: sparse:     expected struct ip_sf_list *psf
>    net/ipv4/igmp.c:3098:29: sparse:     got struct ip_sf_list [noderef] __rcu *sources
>

Thanks, I will squash in V2:

diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index 5516329c9caa5f6f3ec7a2f633bda5d1a16eb4ec..d56355aca79776575d93e338109b768f9acf2eaa
100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -3095,7 +3095,7 @@ static inline struct ip_sf_list
*igmp_mcf_get_first(struct seq_file *seq)
                im = rcu_dereference(idev->mc_list);
                if (likely(im)) {
                        spin_lock_bh(&im->lock);
-                       psf = im->sources;
+                       psf = pmc_dereference(im->sources, im);
                        if (likely(psf)) {
                                state->im = im;
                                state->idev = idev;
@@ -3111,7 +3111,7 @@ static struct ip_sf_list
*igmp_mcf_get_next(struct seq_file *seq, struct ip_sf_l
 {
        struct igmp_mcf_iter_state *state = igmp_mcf_seq_private(seq);

-       psf = psf->sf_next;
+       psf = pmc_dereference(psf->sf_next, state->im);
        while (!psf) {
                spin_unlock_bh(&state->im->lock);
                state->im = state->im->next;
@@ -3127,7 +3127,7 @@ static struct ip_sf_list
*igmp_mcf_get_next(struct seq_file *seq, struct ip_sf_l
                        state->im = rcu_dereference(state->idev->mc_list);
                }
                spin_lock_bh(&state->im->lock);
-               psf = state->im->sources;
+               psf = pmc_dereference(state->im->sources, state->im);
        }
 out:
        return psf;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.