Skip to content

Commit e606e4b

Browse files
kovalev0kees
authored andcommitted
VMCI: Fix possible memcpy() run-time warning in vmci_datagram_invoke_guest_handler()
The changes are similar to those given in the commit 19b070f ("VMCI: Fix memcpy() run-time warning in dg_dispatch_as_host()"). Fix filling of the msg and msg_payload in dg_info struct, which prevents a possible "detected field-spanning write" of memcpy warning that is issued by the tracking mechanism __fortify_memcpy_chk. Signed-off-by: Vasiliy Kovalev <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Kees Cook <[email protected]>
1 parent f0b7f8a commit e606e4b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/misc/vmw_vmci/vmci_datagram.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,8 @@ int vmci_datagram_invoke_guest_handler(struct vmci_datagram *dg)
378378

379379
dg_info->in_dg_host_queue = false;
380380
dg_info->entry = dst_entry;
381-
memcpy(&dg_info->msg, dg, VMCI_DG_SIZE(dg));
381+
dg_info->msg = *dg;
382+
memcpy(&dg_info->msg_payload, dg + 1, dg->payload_size);
382383

383384
INIT_WORK(&dg_info->work, dg_delayed_dispatch);
384385
schedule_work(&dg_info->work);

0 commit comments

Comments
 (0)