From 66cc73a304b520675ed558fe95e000859fa04cbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Corentin=20No=C3=ABl?= Date: Wed, 24 Jan 2024 13:30:24 +0100 Subject: [PATCH] zink: Initialize zink_bindless_descriptor to zero on creation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make sure to have all fields to 0 as we are then using pipe_resource_reference on some of its fields. Fix defect reported by Coverity Scan. Uninitialized pointer read Incorrect values could be read from, or even written to, an arbitrary memory location, causing incorrect computations. CID: 1520759 Signed-off-by: Corentin Noël Part-of: --- src/gallium/drivers/zink/zink_context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index b5775216e69..9945ff1ce76 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -2405,7 +2405,7 @@ zink_create_image_handle(struct pipe_context *pctx, const struct pipe_image_view debug_printf("couldn't create storage image!"); return 0; } - bd = malloc(sizeof(struct zink_bindless_descriptor)); + bd = calloc(1, sizeof(struct zink_bindless_descriptor)); if (!bd) return 0; bd->sampler = NULL;