From: Rhys Perry Date: Wed, 19 Feb 2020 15:09:38 +0000 (+0000) Subject: glsl/list: use uintptr_t for exec_node_data()'s subtraction X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4d0203aa830a6dfabb163514a5a8cd5b5b7bd86e;p=mesa.git glsl/list: use uintptr_t for exec_node_data()'s subtraction 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 Reviewed-by: Matt Turner Tested-by: Marge Bot Part-of: --- diff --git a/src/compiler/glsl/list.h b/src/compiler/glsl/list.h index ed77dcfab41..c80f776ae16 100644 --- a/src/compiler/glsl/list.h +++ b/src/compiler/glsl/list.h @@ -281,7 +281,7 @@ inline bool exec_node::is_head_sentinel() const * \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;