[PATCH nft] expression: fix constant expression allocation on big endian with partial bytes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
Signed-off-by: Sabrina Dubroca <sd@xxxxxxxxxxxxxxx>
---
 include/utils.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/utils.h b/include/utils.h
index 310389c22fab..01560eae8d7f 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
-- 
2.17.0

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux