This fixes UBSan warnings when foreach_list_typed_safe() passes NULL:
pointer index expression with base 0x000000000000 overflowed to 0xffffffffffffffa8
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4157>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4157>
* \param field Name of the field in \c type that is the embedded \c exec_node
*/
#define exec_node_data(type, node, field) \
- ((type *) (((char *) node) - exec_list_offsetof(type, field, node)))
+ ((type *) (((uintptr_t) node) - exec_list_offsetof(type, field, node)))
#ifdef __cplusplus
struct exec_node;