From: Benjamin Berg Date: Sun, 3 Nov 2024 21:28:51 +0000 (+0100) Subject: um: virtio_uml: send SET_MEM_TABLE message with the exact size X-Git-Tag: v6.13-rc1~18^2~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fcbd26d33dfa40496b6d82973bc49f95e6df21f9;p=thirdparty%2Fkernel%2Flinux.git um: virtio_uml: send SET_MEM_TABLE message with the exact size The rust based userspace vhost devices are very strict and will not accept the message if it is longer than required. So, only include the data for the first memory region. Signed-off-by: Benjamin Berg Link: https://patch.msgid.link/20241103212854.1436046-2-benjamin@sipsolutions.net Signed-off-by: Johannes Berg --- diff --git a/arch/um/drivers/virtio_uml.c b/arch/um/drivers/virtio_uml.c index 4d3e9b9f5b614..c602892f329f5 100644 --- a/arch/um/drivers/virtio_uml.c +++ b/arch/um/drivers/virtio_uml.c @@ -623,7 +623,7 @@ static int vhost_user_set_mem_table(struct virtio_uml_device *vu_dev) { struct vhost_user_msg msg = { .header.request = VHOST_USER_SET_MEM_TABLE, - .header.size = sizeof(msg.payload.mem_regions), + .header.size = offsetof(typeof(msg.payload.mem_regions), regions[1]), .payload.mem_regions.num = 1, }; unsigned long reserved = uml_reserved - uml_physmem;