mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 07:13:54 -06:00
kvm: consistently return 0/-errno from kvm_convert_memory
In case of incorrect parameters, kvm_convert_memory() was returning -1 instead of -EINVAL. The guest won't notice because it will move anyway to RUN_STATE_INTERNAL_ERROR, but fix this for consistency and clarity. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
e05fbacd20
commit
b8f8c10f85
1 changed files with 4 additions and 4 deletions
|
@ -2999,17 +2999,17 @@ int kvm_convert_memory(hwaddr start, hwaddr size, bool to_private)
|
|||
MemoryRegion *mr;
|
||||
RAMBlock *rb;
|
||||
void *addr;
|
||||
int ret = -1;
|
||||
int ret = -EINVAL;
|
||||
|
||||
trace_kvm_convert_memory(start, size, to_private ? "shared_to_private" : "private_to_shared");
|
||||
|
||||
if (!QEMU_PTR_IS_ALIGNED(start, qemu_real_host_page_size()) ||
|
||||
!QEMU_PTR_IS_ALIGNED(size, qemu_real_host_page_size())) {
|
||||
return -1;
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (!size) {
|
||||
return -1;
|
||||
return ret;
|
||||
}
|
||||
|
||||
section = memory_region_find(get_system_memory(), start, size);
|
||||
|
@ -3027,7 +3027,7 @@ int kvm_convert_memory(hwaddr start, hwaddr size, bool to_private)
|
|||
if (!to_private) {
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (!memory_region_has_guest_memfd(mr)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue