lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y86Lji5prQEAxKLi@unreal>
Date:   Mon, 23 Jan 2023 15:28:46 +0200
From:   Leon Romanovsky <leon@...nel.org>
To:     Gavrilov Ilia <Ilia.Gavrilov@...otecs.ru>
Cc:     Pablo Neira Ayuso <pablo@...filter.org>,
        Jozsef Kadlecsik <kadlec@...filter.org>,
        Florian Westphal <fw@...len.de>,
        "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>, Joe Perches <joe@...ches.com>,
        "netfilter-devel@...r.kernel.org" <netfilter-devel@...r.kernel.org>,
        "coreteam@...filter.org" <coreteam@...filter.org>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "lvc-project@...uxtesting.org" <lvc-project@...uxtesting.org>
Subject: Re: [PATCH] netfilter: conntrack: remote a return value of the
 'seq_print_acct' function.

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@...otecs.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ