From 3e07f57d4ad7dcc85690de9f595a94ef9ad3fae1 Mon Sep 17 00:00:00 2001 From: Yiwei Zhang Date: Sun, 26 Oct 2025 20:20:46 -0700 Subject: [PATCH] llvmpipe: fix udmabuf mmap error check Upon failing to mmap, MAP_FAILED (void *)-1 is returned instead of NULL. Fixes: d74ea2c117f ("llvmpipe: Implement dmabuf handling") Reviewed-by: Christian Gmeiner Part-of: --- src/gallium/drivers/llvmpipe/lp_texture.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c index b0eea5a932c..593f6d4d85f 100644 --- a/src/gallium/drivers/llvmpipe/lp_texture.c +++ b/src/gallium/drivers/llvmpipe/lp_texture.c @@ -1415,8 +1415,7 @@ llvmpipe_resource_alloc_udmabuf(struct llvmpipe_screen *screen, struct pipe_memory_allocation *data = mmap(NULL, size, PROT_WRITE | PROT_READ, MAP_SHARED, mem_fd, 0); - - if (!data) + if (data == MAP_FAILED) goto fail; alloc->mem_fd = mem_fd;