From 23ea089ebcdb92cf00b1f67e4fed85dfc8937a7e Mon Sep 17 00:00:00 2001 From: Sabrina Dubroca Date: Thu, 19 Apr 2018 10:45:23 +0200 Subject: 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 --- include/utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') 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 -- cgit v1.2.3