Mesa (master): iris: Do not dereference nullptr with pipe_reference
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Feb 19 10:43:29 UTC 2020
Module: Mesa
Branch: master
Commit: 72154237fb720926d8453e7f43f0ec76a0ce7bb1
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=72154237fb720926d8453e7f43f0ec76a0ce7bb1
Author: Danylo Piliaiev <danylo.piliaiev at globallogic.com>
Date: Fri Feb 14 15:37:23 2020 +0200
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 at globallogic.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at 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>
---
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;
More information about the mesa-commit
mailing list