From 72154237fb720926d8453e7f43f0ec76a0ce7bb1 Mon Sep 17 00:00:00 2001 From: Danylo Piliaiev Date: Fri, 14 Feb 2020 15:37:23 +0200 Subject: [PATCH] iris: Do not dereference nullptr with pipe_reference ../src/gallium/drivers/iris/iris_fence.h:54:8: runtime error: member access within null pointer of type 'struct iris_syncpt' ../src/gallium/drivers/iris/iris_fence.c:136:8: runtime error: member access within null pointer of type 'struct pipe_fence_handle' Signed-off-by: Danylo Piliaiev Reviewed-by: Lionel Landwerlin Tested-by: Marge Bot Part-of: --- src/gallium/drivers/iris/iris_fence.c | 3 ++- src/gallium/drivers/iris/iris_fence.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/iris/iris_fence.c b/src/gallium/drivers/iris/iris_fence.c index b163ef5a23b..d8c3bd932ce 100644 --- a/src/gallium/drivers/iris/iris_fence.c +++ b/src/gallium/drivers/iris/iris_fence.c @@ -133,7 +133,8 @@ iris_fence_reference(struct pipe_screen *p_screen, struct pipe_fence_handle **dst, struct pipe_fence_handle *src) { - if (pipe_reference(&(*dst)->ref, &src->ref)) + if (pipe_reference(*dst ? &(*dst)->ref : NULL, + src ? &src->ref : NULL)) iris_fence_destroy(p_screen, *dst); *dst = src; diff --git a/src/gallium/drivers/iris/iris_fence.h b/src/gallium/drivers/iris/iris_fence.h index caf2ceeb315..0ce5fa8ebfb 100644 --- a/src/gallium/drivers/iris/iris_fence.h +++ b/src/gallium/drivers/iris/iris_fence.h @@ -51,7 +51,8 @@ iris_syncpt_reference(struct iris_screen *screen, struct iris_syncpt **dst, struct iris_syncpt *src) { - if (pipe_reference(&(*dst)->ref, &src->ref)) + if (pipe_reference(*dst ? &(*dst)->ref : NULL, + src ? &src->ref: NULL)) iris_syncpt_destroy(screen, *dst); *dst = src; -- 2.30.2