Patchwork [RFC,2/2,nf_tables] netfilter: nf_tables: round to 32 bits in payload operations

login
register
mail settings
Submitter Pablo Neira
Date Oct. 28, 2013, 12:59 p.m.
Message ID <1382965180-9400-3-git-send-email-pablo@netfilter.org>
Download mbox | patch
Permalink /patch/286511/
State Deferred
Headers show

Comments

Pablo Neira - Oct. 28, 2013, 12:59 p.m.
If you need to fetch less than 32 bits, round it up to 32 bits
to make sure that it zeroes the remaining part of the register.

This changes is required by concatenations.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/netfilter/nf_tables_core.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Patch

diff --git a/net/netfilter/nf_tables_core.c b/net/netfilter/nf_tables_core.c
index b814b0c4..5feb409 100644
--- a/net/netfilter/nf_tables_core.c
+++ b/net/netfilter/nf_tables_core.c
@@ -54,11 +54,11 @@  static bool nft_payload_fast_eval(const struct nft_expr *expr,
 		return false;
 
 	if (priv->len == 2)
-		*(u16 *)dest = *(u16 *)ptr;
+		*dest = *(u16 *)ptr;
 	else if (priv->len == 4)
-		*(u32 *)dest = *(u32 *)ptr;
+		*dest = *(u32 *)ptr;
 	else
-		*(u8 *)dest = *(u8 *)ptr;
+		*dest = *(u8 *)ptr;
 	return true;
 }