public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: sun jian <sun.jian.kdev@gmail.com>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>,
	Phil Sutter <phil@nwl.cc>, Simon Horman <horms@kernel.org>,
	netfilter-devel@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] netfilter: amanda: fix RCU pointer typing for nf_nat_amanda_hook
Date: Tue, 3 Feb 2026 17:59:28 +0100	[thread overview]
Message-ID: <aYIpcHBufnxrcv5O@strlen.de> (raw)
In-Reply-To: <CABFUUZG9LnhXc+nsQA28WHiiT33_5wQ82E1bBSBncWkxkXaKZA@mail.gmail.com>

sun jian <sun.jian.kdev@gmail.com> wrote:
> > Sun Jian <sun.jian.kdev@gmail.com> wrote:
> > >  enum amanda_strings {
> > > @@ -98,7 +98,12 @@ static int amanda_help(struct sk_buff *skb,
> > >       u_int16_t len;
> > >       __be16 port;
> > >       int ret = NF_ACCEPT;
> > > -     typeof(nf_nat_amanda_hook) nf_nat_amanda;
> > > +     unsigned int (*nf_nat_amanda)(struct sk_buff *skb,
> > > +                                   enum ip_conntrack_info ctinfo,
> > > +                                   unsigned int protoff,
> > > +                                   unsigned int matchoff,
> > > +                                   unsigned int matchlen,
> > > +                                   struct nf_conntrack_expect *exp);
> >
> > Why is that needed?
> Correct. Manual declaration is indeed verbose.
> 
> The reason I used it was that typeof(nf_nat_amanda_hook) carries over
> the __rcu attribute to the local variable, which triggers a Sparse
> warning when assigning the result of rcu_dereference().

sparse doesn't generate such a warning for me.

Also, this pattern you are changing here isn't specific to amanda, it
exists elsewhere as well:

net/netfilter/nf_conntrack_snmp.c:42:23: error: incompatible types in comparison expression (different address spaces):
net/netfilter/nf_conntrack_tftp.c:78:31: error: incompatible types in comparison expression (different address spaces):
net/netfilter/nf_conntrack_irc.c:242:38: error: incompatible types in comparison expression (different address spaces):
net/netfilter/nf_conntrack_ftp.c:521:22: error: incompatible types in comparison expression (different address spaces):

so why only fix this annotation for amanda?

  reply	other threads:[~2026-02-03 16:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-03  8:01 [PATCH] netfilter: amanda: fix RCU pointer typing for nf_nat_amanda_hook Sun Jian
2026-02-03 13:50 ` Florian Westphal
2026-02-03 14:36   ` sun jian
2026-02-03 14:55 ` [PATCH v2] " Sun Jian
2026-02-03 15:03   ` Florian Westphal
2026-02-03 16:19     ` sun jian
2026-02-03 16:59       ` Florian Westphal [this message]
2026-02-04  1:56         ` sun jian
2026-02-04  2:31           ` sun jian
2026-02-04 12:24             ` Florian Westphal
2026-02-04 14:49               ` sun jian

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=aYIpcHBufnxrcv5O@strlen.de \
    --to=fw@strlen.de \
    --cc=horms@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    --cc=phil@nwl.cc \
    --cc=sun.jian.kdev@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox