> The virtio specification allows creating a blob without backing storage
> attached. However, virtio-gpu attempts to create an empty udmabuf for
> such a blob. The ioctl fails with EINVAL and emits a spurious warning.
> Avoid the invalid ioctl.
>
> Signed-off-by: Akihiko Odaki <[email protected]>
> Message-ID: <[email protected]>
>
> diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
> index fbb6fec7a0ad..6bd87d900170 100644
> --- a/hw/display/virtio-gpu.c
> +++ b/hw/display/virtio-gpu.c
> @@ -363,27 +363,29 @@ static void virtio_gpu_resource_create_blob(VirtIOGPU *g,
> res->resource_id = cblob.resource_id;
> res->blob_size = cblob.size;
>
> - ret = virtio_gpu_create_mapping_iov(g, cblob.nr_entries, sizeof(cblob),
> - cmd, &res->addrs, &res->iov,
> - &res->iov_cnt);
> - if (ret < 0) {
> - cmd->error = VIRTIO_GPU_RESP_ERR_UNSPEC;
> - g_free(res);
> - return;
> + if (cblob.nr_entries) {
> + ret = virtio_gpu_create_mapping_iov(g, cblob.nr_entries, sizeof(cblob),
> + cmd, &res->addrs, &res->iov,
> + &res->iov_cnt);
> + if (ret < 0) {
> + cmd->error = VIRTIO_GPU_RESP_ERR_UNSPEC;
> + g_free(res);
> + return;
> + }
> +
> + if (iov_size(res->iov, res->iov_cnt) < res->blob_size) {
> + qemu_log_mask(LOG_GUEST_ERROR,
> + "%s: backing storage smaller than blob size\n",
> + __func__);
Continuation lines are two spaces short of aligning after the opening
paren of qemu_log_mask().
--
Marc-André Lureau <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.