From: liqiong <liqiong@nfschina.com>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>,
Jozsef Kadlecsik <kadlec@netfilter.org>,
Florian Westphal <fw@strlen.de>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
netfilter-devel@vger.kernel.org, kernel-janitors@vger.kernel.org,
coreteam@netfilter.org, Yu Zhe <yuzhe@nfschina.com>
Subject: Re: [PATCH] netfilter: initialize 'ret' variable
Date: Fri, 2 Dec 2022 16:06:43 +0800 [thread overview]
Message-ID: <533ef392-5b77-9939-a961-872467d49cc3@nfschina.com> (raw)
In-Reply-To: <Y4mljMYvNh7zHlOh@ZenIV>
> On Fri, Dec 02, 2022 at 03:03:31PM +0800, Li Qiong wrote:
>> The 'ret' should need to be initialized to 0, in case
>> return a uninitialized value.
> Why is 0 the right value? And which case would it be?
> We clearly need to know that to figure out which return
> value would be correct for it...
Hi,
here is a case:
for (i = 0; i < e->num_hook_entries; i++) {
ret = e->hooks[i].hook(e->hooks[i].priv, skb, state);
if (ret != NF_ACCEPT)
return ret;
....
}
I am not sure if 0 (NF_DROP) is the best value, but It's better to initialize a value.
next prev parent reply other threads:[~2022-12-02 8:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-02 7:03 Li Qiong
2022-12-02 7:13 ` Al Viro
2022-12-02 8:06 ` liqiong [this message]
2022-12-02 9:18 ` Jan Engelhardt
2022-12-05 14:26 ` Pablo Neira Ayuso
2022-12-06 0:29 ` liqiong
2022-12-06 7:44 ` [PATCH v2] netfilter: add a 'default' case to 'switch (tuplehash->tuple.xmit_type)' Li Qiong
2022-12-08 21:12 ` Pablo Neira Ayuso
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=533ef392-5b77-9939-a961-872467d49cc3@nfschina.com \
--to=liqiong@nfschina.com \
--cc=coreteam@netfilter.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=fw@strlen.de \
--cc=kadlec@netfilter.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pablo@netfilter.org \
--cc=viro@zeniv.linux.org.uk \
--cc=yuzhe@nfschina.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
all inboxes | Powered by JetHome®