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));
> +
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