On Thursday, September 15, 2016 9:00:35 PM PDT Jason Ekstrand wrote: > --- > src/compiler/glsl/list.h | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/src/compiler/glsl/list.h b/src/compiler/glsl/list.h > index b5b5b36..8371519 100644 > --- a/src/compiler/glsl/list.h > +++ b/src/compiler/glsl/list.h > @@ -714,6 +714,15 @@ inline void exec_node::insert_before(exec_list *before) > __node = __next, __next = \ > exec_node_data(__type, (__next)->__field.next, __field)) >
Perhaps add: /* __after must be a valid list node (not the tail sentinel) */ (if after is the tail sentinel, __node will be NULL, and then trying to obtain (__node)->__field.next will dereference that NULL pointer.) Either way, patch 1 is Reviewed-by: Kenneth Graunke <kenn...@whitecape.org> (I haven't thought about patch 2, sorry) > +#define foreach_list_typed_safe_after(__type, __node, __field, __after) \ > + for (__type * __node = \ > + exec_node_data(__type, (__after)->__field.next, __field), \ > + * __next = \ > + exec_node_data(__type, (__node)->__field.next, __field); \ > + (__node)->__field.next != NULL; \ > + __node = __next, __next = \ > + exec_node_data(__type, (__next)->__field.next, __field)) > + > #define foreach_list_typed_reverse_safe(__type, __node, __field, __list) \ > for (__type * __node = \ > exec_node_data(__type, (__list)->tail_sentinel.prev, __field), \ >
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev