[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <b9cdfee5-0df3-45c1-ac83-123c7b6c2955@iogearbox.net>
Date: Fri, 25 Oct 2024 13:32:33 +0200
From: Daniel Borkmann <daniel@...earbox.net>
To: Puranjay Mohan <puranjay@...nel.org>, kernel test robot <lkp@...el.com>,
Albert Ou <aou@...s.berkeley.edu>, Alexei Starovoitov <ast@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Andrii Nakryiko <andrii@...nel.org>, bpf@...r.kernel.org,
"David S. Miller" <davem@...emloft.net>, Eduard Zingerman
<eddyz87@...il.com>, Eric Dumazet <edumazet@...gle.com>,
Hao Luo <haoluo@...gle.com>, Helge Deller <deller@....de>,
Jakub Kicinski <kuba@...nel.org>,
"James E.J. Bottomley" <James.Bottomley@...senpartnership.com>,
Jiri Olsa <jolsa@...nel.org>, John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>, linux-kernel@...r.kernel.org,
linux-parisc@...r.kernel.org, linux-riscv@...ts.infradead.org,
Martin KaFai Lau <martin.lau@...ux.dev>, Mykola Lysenko <mykolal@...com>,
Palmer Dabbelt <palmer@...belt.com>, Paolo Abeni <pabeni@...hat.com>,
Paul Walmsley <paul.walmsley@...ive.com>,
Shuah Khan <skhan@...uxfoundation.org>, Song Liu <song@...nel.org>,
Stanislav Fomichev <sdf@...ichev.me>
Cc: oe-kbuild-all@...ts.linux.dev,
Linux Memory Management List <linux-mm@...ck.org>, netdev@...r.kernel.org
Subject: Re: [PATCH bpf-next v2 2/4] bpf: bpf_csum_diff: optimize and
homogenize for all archs
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
Powered by blists - more mailing lists