From: Sabrina Dubroca Date: Thu, 19 Apr 2018 08:45:23 +0000 (+0200) Subject: expression: fix constant expression allocation on big endian with partial bytes X-Git-Tag: v0.8.4~19 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=23ea089ebcdb92cf00b1f67e4fed85dfc8937a7e;p=thirdparty%2Fnftables.git 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 Signed-off-by: Sabrina Dubroca Signed-off-by: Pablo Neira Ayuso --- 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