From: Honglei Huang Date: Tue, 13 Jan 2026 01:52:02 +0000 (+0800) Subject: virtio-gpu: fix error handling in virgl_cmd_resource_create_blob X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3560b51979577afc3ab937fd8b02597515bdfbae;p=thirdparty%2Fqemu.git virtio-gpu: fix error handling in virgl_cmd_resource_create_blob Fix inverted error check in virgl_cmd_resource_create_blob() that causes the function to return error when virtio_gpu_create_mapping_iov() succeeds. virtio_gpu_create_mapping_iov() returns 0 on success and negative values on error. The check 'if (!ret)' incorrectly treats success (ret=0) as an error condition, causing the function to fail when it should succeed. Change the condition to 'if (ret != 0)' to properly detect errors. Fixes: 7c092f17ccee ("virtio-gpu: Handle resource blob commands") Signed-off-by: Honglei Huang Reviewed-by: Akihiko Odaki Reviewed-by: Dmitry Osipenko Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Message-Id: <20260113015203.3643608-2-honghuan@amd.com> --- diff --git a/hw/display/virtio-gpu-virgl.c b/hw/display/virtio-gpu-virgl.c index 6a83fb63c8..741728cabb 100644 --- a/hw/display/virtio-gpu-virgl.c +++ b/hw/display/virtio-gpu-virgl.c @@ -705,7 +705,7 @@ static void virgl_cmd_resource_create_blob(VirtIOGPU *g, ret = virtio_gpu_create_mapping_iov(g, cblob.nr_entries, sizeof(cblob), cmd, &res->base.addrs, &res->base.iov, &res->base.iov_cnt); - if (!ret) { + if (ret != 0) { cmd->error = VIRTIO_GPU_RESP_ERR_UNSPEC; return; }