From 74ff3f70bb37fb3f33733af0d006ec3858a7b407 Mon Sep 17 00:00:00 2001 From: Lucas Stach Date: Tue, 22 Nov 2022 10:21:43 +0100 Subject: [PATCH] etnaviv: fix NULL pointer dereference in TS allocation Commit c2b06e1a3820 ("etnaviv: add support for sharing the TS buffer") introduced a problem similar to the one fixed in 3b3cd5128672 ("etnaviv: fix renderonly check in etna_resource_alloc") in a different code path. This causes a NULL pointer dereference when the screen is instanciated on the render node. Fix it in the same way by just checking for a valid pointer. Signed-off-by: Lucas Stach Reviewed-by: Christian Gmeiner Part-of: --- src/gallium/drivers/etnaviv/etnaviv_resource.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c b/src/gallium/drivers/etnaviv/etnaviv_resource.c index 149387ad7af..3f4e3869832 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_resource.c +++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c @@ -154,7 +154,7 @@ etna_screen_resource_alloc_ts(struct pipe_screen *pscreen, DBG_F(ETNA_DBG_RESOURCE_MSGS, "%p: Allocating tile status of size %zu", rsc, ts_bo_size); - if ((rsc->base.bind & PIPE_BIND_SCANOUT) && screen->ro->kms_fd >= 0) { + if ((rsc->base.bind & PIPE_BIND_SCANOUT) && screen->ro) { struct pipe_resource scanout_templat; struct winsys_handle handle;