linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Borkmann <daniel@iogearbox.net>
To: Puranjay Mohan <puranjay@kernel.org>,
	kernel test robot <lkp@intel.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Alexei Starovoitov <ast@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Andrii Nakryiko <andrii@kernel.org>,
	bpf@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
	Eduard Zingerman <eddyz87@gmail.com>,
	Eric Dumazet <edumazet@google.com>, Hao Luo <haoluo@google.com>,
	Helge Deller <deller@gmx.de>, Jakub Kicinski <kuba@kernel.org>,
	"James E.J. Bottomley" <James.Bottomley@hansenpartnership.com>,
	Jiri Olsa <jolsa@kernel.org>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@kernel.org>,
	linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org,
	linux-riscv@lists.infradead.org,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Mykola Lysenko <mykolal@fb.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Paolo Abeni <pabeni@redhat.com>,
	Paul Walmsley <paul.walmsley@sifive.com>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Song Liu <song@kernel.org>, Stanislav Fomichev <sdf@fomichev.me>
Cc: oe-kbuild-all@lists.linux.dev,
	Linux Memory Management List <linux-mm@kvack.org>,
	netdev@vger.kernel.org
Subject: Re: [PATCH bpf-next v2 2/4] bpf: bpf_csum_diff: optimize and homogenize for all archs
Date: Fri, 25 Oct 2024 13:32:33 +0200	[thread overview]
Message-ID: <b9cdfee5-0df3-45c1-ac83-123c7b6c2955@iogearbox.net> (raw)
In-Reply-To: <mb61po738bigw.fsf@kernel.org>

On 10/25/24 12:11 PM, Puranjay Mohan wrote:
[...]
> This file has a lot of such sparse warnings. Specifically, to fix the
> warning introduced by me, I can apply the following diff:
> 
> --- >8 ---
> 
> diff --git a/net/core/filter.c b/net/core/filter.c
> index e00bec7de9ed..b94037f29b2a 100644
> --- a/net/core/filter.c
> +++ b/net/core/filter.c
> @@ -2019,16 +2019,18 @@ BPF_CALL_5(bpf_csum_diff, __be32 *, from, u32, from_size,
>           * Even for diffing, from_size and to_size don't need to be equal.
>           */
> 
> +       __wsum ret = seed;
> +
>          if (from_size && to_size)
> -               return csum_from32to16(csum_sub(csum_partial(to, to_size, seed),
> -                                               csum_partial(from, from_size, 0)));
> +               ret = csum_sub(csum_partial(to, to_size, seed), csum_partial(from, from_size, 0));

Lets also pass ret into csum_partial() instead of seed given the arg
is of type __wsum there too, otherwise lgtm and yes lets fix these.

> +
>          if (to_size)
> -               return csum_from32to16(csum_partial(to, to_size, seed));
> +               ret =  csum_partial(to, to_size, seed);
> 
>          if (from_size)
> -               return csum_from32to16(~csum_partial(from, from_size, ~seed));
> +               ret = ~csum_partial(from, from_size, ~seed);
> 
> -       return seed;
> +       return csum_from32to16((__force unsigned int)ret);
>   }
> 
> --- 8< ---
> 
> If others feel that fixing these warnings is useful, I can send another
> version with above diff. I will then also send a separate patch to fix
> all other such warnings in this file.

That would be great, as separate patch, agree.

Thanks,
Daniel


      reply	other threads:[~2024-12-05 15:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20241023153922.86909-3-puranjay@kernel.org>
2024-10-25  7:38 ` kernel test robot
2024-10-25 10:11   ` Puranjay Mohan
2024-10-25 11:32     ` Daniel Borkmann [this message]

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=b9cdfee5-0df3-45c1-ac83-123c7b6c2955@iogearbox.net \
    --to=daniel@iogearbox.net \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=akpm@linux-foundation.org \
    --cc=andrii@kernel.org \
    --cc=aou@eecs.berkeley.edu \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=davem@davemloft.net \
    --cc=deller@gmx.de \
    --cc=eddyz87@gmail.com \
    --cc=edumazet@google.com \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-parisc@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=lkp@intel.com \
    --cc=martin.lau@linux.dev \
    --cc=mykolal@fb.com \
    --cc=netdev@vger.kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=pabeni@redhat.com \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=puranjay@kernel.org \
    --cc=sdf@fomichev.me \
    --cc=skhan@linuxfoundation.org \
    --cc=song@kernel.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