netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gavrilov Ilia <Ilia.Gavrilov@infotecs.ru>
To: Leon Romanovsky <leon@kernel.org>
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>,
	Joe Perches <joe@perches.com>,
	"netfilter-devel@vger.kernel.org"
	<netfilter-devel@vger.kernel.org>,
	"coreteam@netfilter.org" <coreteam@netfilter.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"lvc-project@linuxtesting.org" <lvc-project@linuxtesting.org>
Subject: Re: [PATCH] netfilter: conntrack: remote a return value of the 'seq_print_acct' function.
Date: Mon, 23 Jan 2023 14:06:39 +0000	[thread overview]
Message-ID: <fbc11588-ac61-4fcb-a8fa-c03dba098fba@infotecs.ru> (raw)
In-Reply-To: <Y86Lji5prQEAxKLi@unreal>




С уважением,
Илья Гаврилов
Ведущий программист
Отдел разработки
АО "ИнфоТеКС" в г. Санкт-Петербург
127287, г. Москва, Старый Петровско-Разумовский проезд, дом 1/23, стр. 1
T: +7 495 737-61-92 ( доб. 4921)
Ф: +7 495 737-72-78


Ilia.Gavrilov@infotecs.ru
www.infotecs.ru


On 1/23/23 16:28, Leon Romanovsky wrote:
> On Mon, Jan 23, 2023 at 08:19:50AM +0000, Gavrilov Ilia wrote:
>> The static 'seq_print_acct' function always returns 0.
>>
>> Change the return value to 'void' and remove unnecessary checks.
>>
>> Found by InfoTeCS on behalf of Linux Verification Center
>> (linuxtesting.org) with SVACE.
>>
>> Fixes: 1ca9e41770cb ("netfilter: Remove uses of seq_<foo> return values")
>> Signed-off-by: Ilia.Gavrilov <Ilia.Gavrilov@infotecs.ru>
>> ---
>>   net/netfilter/nf_conntrack_standalone.c | 26 ++++++++++---------------
>>   1 file changed, 10 insertions(+), 16 deletions(-)
>>
>> diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c
>> index 0250725e38a4..bee99d4bcf36 100644
>> --- a/net/netfilter/nf_conntrack_standalone.c
>> +++ b/net/netfilter/nf_conntrack_standalone.c
>> @@ -275,22 +275,18 @@ static const char* l4proto_name(u16 proto)
>>   return "unknown";
>>   }
>>
>> -static unsigned int
>> +static void
>>   seq_print_acct(struct seq_file *s, const struct nf_conn *ct, int dir)
>>   {
>> -struct nf_conn_acct *acct;
>> -struct nf_conn_counter *counter;
>> +struct nf_conn_acct *acct = nf_conn_acct_find(ct);
>>
>> -acct = nf_conn_acct_find(ct);
>> -if (!acct)
>> -return 0;
>> -
>> -counter = acct->counter;
>> -seq_printf(s, "packets=%llu bytes=%llu ",
>> -   (unsigned long long)atomic64_read(&counter[dir].packets),
>> -   (unsigned long long)atomic64_read(&counter[dir].bytes));
>> +if (acct) {
>> +struct nf_conn_counter *counter = acct->counter;
>>
>> -return 0;
>> +seq_printf(s, "packets=%llu bytes=%llu ",
>> +   (unsigned long long)atomic64_read(&counter[dir].packets),
>> +   (unsigned long long)atomic64_read(&counter[dir].bytes));
>> +}
>
> The preferred linux kernel style is to perform if (check_error) return;
> In this case, this pattern should stay.
>
> acct = nf_conn_acct_find(ct);
> if (!acct)
>     return;
>
> Thanks

Thank you for review. I'll fix it in v2.

  reply	other threads:[~2023-01-23 14:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-23  8:19 [PATCH] netfilter: conntrack: remote a return value of the 'seq_print_acct' function Gavrilov Ilia
2023-01-23 13:28 ` Leon Romanovsky
2023-01-23 14:06   ` Gavrilov Ilia [this message]
2023-01-23 14:31   ` [PATCH v2] " Gavrilov Ilia
2023-01-23 17:44     ` Leon Romanovsky
2023-02-01 11:17     ` 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=fbc11588-ac61-4fcb-a8fa-c03dba098fba@infotecs.ru \
    --to=ilia.gavrilov@infotecs.ru \
    --cc=coreteam@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=fw@strlen.de \
    --cc=joe@perches.com \
    --cc=kadlec@netfilter.org \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lvc-project@linuxtesting.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pablo@netfilter.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).