Skip to content

Commit

Permalink
netfilter: bitwise: replace hard-coded size with sizeof expression
Browse files Browse the repository at this point in the history
When calculating the length of an array, use the appropriate `sizeof`
expression for its type, rather than an integer literal.

Signed-off-by: Jeremy Sowden <[email protected]>
Signed-off-by: Florian Westphal <[email protected]>
  • Loading branch information
a3a3el authored and Florian Westphal committed Apr 9, 2022
1 parent c3e3486 commit c70b921
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/netfilter/nft_bitwise.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ static void nft_bitwise_eval_bool(u32 *dst, const u32 *src,
{
unsigned int i;

for (i = 0; i < DIV_ROUND_UP(priv->len, 4); i++)
for (i = 0; i < DIV_ROUND_UP(priv->len, sizeof(u32)); i++)
dst[i] = (src[i] & priv->mask.data[i]) ^ priv->xor.data[i];
}

Expand Down

0 comments on commit c70b921

Please sign in to comment.