Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

netfilter: nf_tables: move nft_cmp_fast_mask to where its used

... and cast result to u32 so sparse won't complain anymore.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>

authored by

Florian Westphal and committed by
Pablo Neira Ayuso
6b772053 ffb3d9a3

+12 -10
-10
include/net/netfilter/nf_tables_core.h
··· 56 56 u8 dlen; 57 57 }; 58 58 59 - /* Calculate the mask for the nft_cmp_fast expression. On big endian the 60 - * mask needs to include the *upper* bytes when interpreting that data as 61 - * something smaller than the full u32, therefore a cpu_to_le32 is done. 62 - */ 63 - static inline u32 nft_cmp_fast_mask(unsigned int len) 64 - { 65 - return cpu_to_le32(~0U >> (sizeof_field(struct nft_cmp_fast_expr, 66 - data) * BITS_PER_BYTE - len)); 67 - } 68 - 69 59 extern const struct nft_expr_ops nft_cmp_fast_ops; 70 60 extern const struct nft_expr_ops nft_cmp16_fast_ops; 71 61
+12
net/netfilter/nft_cmp.c
··· 197 197 .offload = nft_cmp_offload, 198 198 }; 199 199 200 + /* Calculate the mask for the nft_cmp_fast expression. On big endian the 201 + * mask needs to include the *upper* bytes when interpreting that data as 202 + * something smaller than the full u32, therefore a cpu_to_le32 is done. 203 + */ 204 + static u32 nft_cmp_fast_mask(unsigned int len) 205 + { 206 + __le32 mask = cpu_to_le32(~0U >> (sizeof_field(struct nft_cmp_fast_expr, 207 + data) * BITS_PER_BYTE - len)); 208 + 209 + return (__force u32)mask; 210 + } 211 + 200 212 static int nft_cmp_fast_init(const struct nft_ctx *ctx, 201 213 const struct nft_expr *expr, 202 214 const struct nlattr * const tb[])