summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSabrina Dubroca <sd@queasysnail.net>2018-04-19 10:45:23 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2018-04-19 13:03:53 +0200
commit23ea089ebcdb92cf00b1f67e4fed85dfc8937a7e (patch)
tree8075244187c4a0c8f316d9a17b145200cbe549e8
parentedf64f6c65e1ebd31713ece236df3de8f7ace444 (diff)
expression: fix constant expression allocation on big endian with partial bytes
Commit 5259feeb7cda ("expression: fix constant expression allocation on big endian") improved constant handling on big endian, but didn't handle the case of partial bytes correctly. Currently, constant_data_ptr(val, 6) points to the item after val, instead of the last byte of val. Thanks to Stefano for providing the correct expression. Fixes: 5259feeb7cda ("expression: fix constant expression allocation on big endian") Signed-off-by: Stefano Brivio <sbrivio@redhat.com> Signed-off-by: Sabrina Dubroca <sd@queasysnail.net> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r--include/utils.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/utils.h b/include/utils.h
index 310389c2..01560eae 100644
--- a/include/utils.h
+++ b/include/utils.h
@@ -51,7 +51,7 @@
((void *)&(val))
#elif defined(__BIG_ENDIAN_BITFIELD)
#define constant_data_ptr(val, len) \
- ((void *)&(val) + sizeof(val) - (len) / BITS_PER_BYTE)
+ ((void *)&(val) + sizeof(val) - div_round_up(len, BITS_PER_BYTE))
#else
#error "byteorder undefined"
#endif