summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDanylo Piliaiev <danylo.piliaiev@globallogic.com>2020-02-14 15:37:23 +0200
committerDanylo Piliaiev <danylo.piliaiev@globallogic.com>2020-02-19 12:07:24 +0200
commit72154237fb720926d8453e7f43f0ec76a0ce7bb1 (patch)
treea01c651ceb91e352b43e2ef889f0240f099fe070 /src
parentd800bcd9b9664dbb0c8476ee628a3eb888802b87 (diff)
downloadmesa-72154237fb720926d8453e7f43f0ec76a0ce7bb1.tar.gz
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 <danylo.piliaiev@globallogic.com> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3825> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3825>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/iris/iris_fence.c3
-rw-r--r--src/gallium/drivers/iris/iris_fence.h3
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;