[Mesa-dev] [PATCH 2/3] etnaviv: move pctx initialisation to avoid a null dereference
Christian Gmeiner
christian.gmeiner at gmail.com
Thu Feb 9 07:19:39 UTC 2017
In case ctx->stream == NULL the fail label gets executed where
pctx gets dereferenced - too bad pctx is NULL in that case.
Caught by Coverity, reported to me by imirkin.
Signed-off-by: Christian Gmeiner <christian.gmeiner at gmail.com>
---
src/gallium/drivers/etnaviv/etnaviv_context.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.c b/src/gallium/drivers/etnaviv/etnaviv_context.c
index d767cd1..9cbbe2e 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_context.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_context.c
@@ -256,15 +256,15 @@ etna_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
if (ctx == NULL)
return NULL;
+ pctx = &ctx->base;
+ pctx->priv = ctx;
+ pctx->screen = pscreen;
+
screen = etna_screen(pscreen);
ctx->stream = etna_cmd_stream_new(screen->pipe, 0x2000, &etna_cmd_stream_reset_notify, ctx);
if (ctx->stream == NULL)
goto fail;
- pctx = &ctx->base;
- pctx->priv = ctx;
- pctx->screen = pscreen;
-
/* context ctxate setup */
ctx->specs = screen->specs;
ctx->screen = screen;
--
2.7.4
More information about the mesa-dev
mailing list