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));
+
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.