Re: [PATCH v6 17/22] KVM: Terminate memslot walks via used_slots

2020-02-21 Thread Paolo Bonzini
On 18/02/20 22:07, Sean Christopherson wrote: > tmp = id_to_memslot(__kvm_memslots(kvm, as_id), id); > - old = *tmp; > - tmp = NULL; > + if (tmp) { > + old = *tmp; > + tmp = NULL; > + } else { > + memset(, 0, sizeof(old)); > +

[PATCH v6 17/22] KVM: Terminate memslot walks via used_slots

2020-02-18 Thread Sean Christopherson
Refactor memslot handling to treat the number of used slots as the de facto size of the memslot array, e.g. return NULL from id_to_memslot() when an invalid index is provided instead of relying on npages==0 to detect an invalid memslot. Rework the sorting and walking of memslots in advance of