]> git.ipfire.org Git - thirdparty/libvirt.git/commit
virDomainMemoryDefValidate: Check for overlapping memory devices
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 22 Sep 2023 09:01:40 +0000 (11:01 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 22 Sep 2023 14:37:10 +0000 (16:37 +0200)
commit3fd64fb0e236fc80ffa2cc977c0d471f11fc39bf
treeb9ac25394959647bb66e9fe3826ae19765242fb8
parenta1d6e18f001e3d4b7c6a726db5fad724406f90ea
virDomainMemoryDefValidate: Check for overlapping memory devices

As of v9.4.0-rc2~5 it is possible to specify guest address where
a virtio-mem/virtio-pmem memory device is mapped to. What that
commit forgot to introduce was a check for overlaps.

And yes, this is technically an O(n^2) algorithm, as
virDomainMemoryDefValidate() is called over each memory device
and after this, virDomainMemoryDefValidate() also iterates over
each memory device. But given there's usually only a handful of
such devices, and this runs only when parsing domain XML I guess
code readability wins over some less obvious solution.

Resolves: https://issues.redhat.com/browse/RHEL-4452
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/conf/domain_validate.c
tests/qemuxml2argvdata/memory-hotplug-virtio-mem-overlap-address.x86_64-latest.err [new file with mode: 0644]
tests/qemuxml2argvdata/memory-hotplug-virtio-mem-overlap-address.xml [new file with mode: 0644]
tests/qemuxml2argvtest.c