Re: [PATCH v6 14/22] KVM: Clean up local variable usage in __kvm_set_memory_region()
From: Paolo Bonzini
Date: Fri Feb 21 2020 - 12:43:47 EST
On 18/02/20 22:07, Sean Christopherson wrote:
> -sorted by update_memslots(), and the old
> * memslot needs to be referenced after calling update_memslots(), e.g.
> - * to free its resources and for arch specific behavior.
> + * to free its resources and for arch specific behavior. Kill @tmp
> + * after making a copy to deter potentially dangerous usage.
> */
> - old = *slot;
> + tmp = id_to_memslot(__kvm_memslots(kvm, as_id), id);
> + old = *tmp;
> + tmp = NULL;
> +
Also: old = *id_to_memslot(...).
Paolo