netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: kaber@trash.net
Subject: [RFC PATCH 2/2 nf_tables] netfilter: nf_tables: round to 32 bits in payload operations
Date: Mon, 28 Oct 2013 13:59:39 +0100	[thread overview]
Message-ID: <1382965180-9400-3-git-send-email-pablo@netfilter.org> (raw)
In-Reply-To: <1382965180-9400-1-git-send-email-pablo@netfilter.org>

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(-)

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;
 }
 
-- 
1.7.10.4


  parent reply	other threads:[~2013-10-28 12:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-28 12:59 [RFC PATCH 0/2 nf_tables] 32/64/128-bits word addressing in nf_tables Pablo Neira Ayuso
2013-10-28 12:59 ` [RFC PATCH 1/2 nf_tables] netfilter: nf_tables: allow 32/64/128-bits register addressing Pablo Neira Ayuso
2013-10-28 12:59 ` Pablo Neira Ayuso [this message]
2013-10-28 12:59 ` [RFC PATCH nft] src: finish concatenation support using the set infrastructure Pablo Neira Ayuso
2013-10-28 13:09 ` [RFC PATCH 0/2 nf_tables] 32/64/128-bits word addressing in nf_tables Patrick McHardy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1382965180-9400-3-git-send-email-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=kaber@trash.net \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).