eal: ensure constness of container_of target
This adds a check to ensure that the container_of() macro is not used to cast away (remove) constness. Signed-off-by: Jan Blunck <jblunck@infradead.org> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
This commit is contained in:
parent
7cfd280578
commit
b2fba63690
@ -348,6 +348,8 @@ rte_bsf32(uint32_t v)
|
||||
#ifndef container_of
|
||||
#define container_of(ptr, type, member) __extension__ ({ \
|
||||
const typeof(((type *)0)->member) *_ptr = (ptr); \
|
||||
__attribute__((unused)) type *_target_ptr = \
|
||||
(type *)(ptr); \
|
||||
(type *)(((uintptr_t)_ptr) - offsetof(type, member)); \
|
||||
})
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user