Skip to contentSkip to conversation

xt_sctp: use WORD_ROUND macro to calculate length of multiple of 4 bytes

PATCH Applied Shan Wei 2 participants 2 messages Jun 7, 2010 – Jun 9, 2010

Subsystems (2)
lore
Share & tools
lore

Shan Wei

author
#0 lore raw

PATCH 1/1 xt_sctp: use WORD_ROUND macro to calculate length of multiple of 4 bytes

Use WORD_ROUND to round an int up to the next multiple of 4.

---
 net/netfilter/xt_sctp.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
net/netfilter/xt_sctp.c +2 -1
index c04fcf3..ef36a56 100644
@@ -3,6 +3,7 @@
 #include <linux/skbuff.h>
 #include <net/ip.h>
 #include <net/ipv6.h>
+#include <net/sctp/sctp.h>
 #include <linux/sctp.h>
 
 #include <linux/netfilter/x_tables.h>
@@ -67,7 +68,7 @@ match_packet(const struct sk_buff *skb,
 			 ++i, offset, sch->type, htons(sch->length),
 			 sch->flags);
 #endif
-		offset += (ntohs(sch->length) + 3) & ~3;
+		offset += WORD_ROUND(ntohs(sch->length));
 
 		pr_debug("skb->len: %d\toffset: %d\n", skb->len, offset);
 
Signature · 1 line
1.6.3.3
#1 lore raw
Quoted 2 lines · Shan Wei

Use WORD_ROUND to round an int up to the next multiple of 4.

Applied, thanks.