zink: fix dereference before NULL check
The `sv->image_view` pointer is dereference before checking whether it's NULL or not. Check for NULL before dereferencing it to avoid a possible crash. Fixes:9de455bc43
("zink: check for sampler view existence during zink_rebind_all_images()") Reviewed-by: Dave Airlie <airlied@redhat.com> Signed-off-by: José Expósito <jexposit@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26140> (cherry picked from commit83ed419cd0
)
This commit is contained in:

committed by
Eric Engestrom

parent
e8c975a642
commit
61bd4b332b
@@ -1334,7 +1334,7 @@
|
|||||||
"description": "zink: fix dereference before NULL check",
|
"description": "zink: fix dereference before NULL check",
|
||||||
"nominated": true,
|
"nominated": true,
|
||||||
"nomination_type": 1,
|
"nomination_type": 1,
|
||||||
"resolution": 0,
|
"resolution": 1,
|
||||||
"main_sha": null,
|
"main_sha": null,
|
||||||
"because_sha": "9de455bc4323d6bb484c1beed77454381e48b432",
|
"because_sha": "9de455bc4323d6bb484c1beed77454381e48b432",
|
||||||
"notes": null
|
"notes": null
|
||||||
|
@@ -4846,7 +4846,7 @@ zink_rebind_all_images(struct zink_context *ctx)
|
|||||||
for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
|
for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
|
||||||
for (unsigned j = 0; j < ctx->di.num_sampler_views[i]; j++) {
|
for (unsigned j = 0; j < ctx->di.num_sampler_views[i]; j++) {
|
||||||
struct zink_sampler_view *sv = zink_sampler_view(ctx->sampler_views[i][j]);
|
struct zink_sampler_view *sv = zink_sampler_view(ctx->sampler_views[i][j]);
|
||||||
if (!sv || sv->image_view->base.texture->target == PIPE_BUFFER || !sv->image_view)
|
if (!sv || !sv->image_view || sv->image_view->base.texture->target == PIPE_BUFFER)
|
||||||
continue;
|
continue;
|
||||||
struct zink_resource *res = zink_resource(sv->image_view->base.texture);
|
struct zink_resource *res = zink_resource(sv->image_view->base.texture);
|
||||||
if (res->obj != sv->image_view->obj) {
|
if (res->obj != sv->image_view->obj) {
|
||||||
|
Reference in New Issue
Block a user