diff options
| author | Thorsten Blum <thorsten.blum@linux.dev> | 2025-09-16 23:31:29 +0200 |
|---|---|---|
| committer | Sean Christopherson <seanjc@google.com> | 2025-10-13 15:11:06 -0700 |
| commit | 0bd0a4a1428baaf4447e95f0832492d9e3d64961 (patch) | |
| tree | 80f7beb2883c7014891824cfd5c28e5f4ac820e2 /drivers/usb/cdns3/cdns3-debug.h | |
| parent | f505c7b16fbeea25f82a7e8d578e128178dd6706 (diff) | |
KVM: TDX: Replace kmalloc + copy_from_user with memdup_user in tdx_td_init()
Use get_user() to retrieve the number of entries instead of allocating
memory for 'init_vm' with the maximum size, copying 'cmd->data' to it,
only to then read the actual entry count 'cpuid.nent' from the copy.
Use memdup_user() to allocate just enough memory to fit all entries and
to copy 'cmd->data' from userspace. Use struct_size() instead of
manually calculating the number of bytes to allocate and copy.
No functional changes intended.
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Link: https://lore.kernel.org/r/20250916213129.2535597-2-thorsten.blum@linux.dev
[sean: s/user_init_vm/user_data]
Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'drivers/usb/cdns3/cdns3-debug.h')
0 files changed, 0 insertions, 0 deletions