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