Re: [PATCH v12 01/12] KVM: guest_memfd: Rename "struct kvm_gmem" to "struct gmem_file"

David Hildenbrand
2025-10-10T15:07:54Z

>> - struct file *gmem_file = READ_ONCE(slot->gmem.file);
>> - struct kvm_gmem *gmem = file->private_data;
>> + struct file *slot_file = READ_ONCE(slot->gmem.file);
>> + struct gmem_file *f = file->private_data;
> ^^^
>> struct folio *folio;
>>
>> - if (file != gmem_file) {
>> - WARN_ON_ONCE(gmem_file);
>> + if (file != slot_file) {
>> + WARN_ON_ONCE(slot_file);
>> return ERR_PTR(-EFAULT);
>> }
>>
>> - gmem = file->private_data;
>> - if (xa_load(&gmem->bindings, index) != slot) {
>> - WARN_ON_ONCE(xa_load(&gmem->bindings, index));
>> + f = file->private_data;
>
> This redundant initialization can be dropped.
>
> I sent a cleanup patch including this change a few weeks ago:
>
> https://lore.kernel.org/kvm/20250902080307.153171-2-shivankg@amd.com

Yeah, Sean/Oaolo, can you take a look and pick that up as well?

--
Cheers

David / dhildenb