Re: [PATCH RFC 07/40] qemu: domain: Tolerate NULL @disk in qemuDomainPrepareDiskSourceData

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 10/18/19 1:10 PM, Peter Krempa wrote:
In some cases we want to prepare a @src which is not meant to belong to
a disk and thus does not require us to copy the data. Allow passing in
NULL @disk into qemuDomainPrepareDiskSourceData.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---

This is worth pushing as a bug fix IMO. Of all callers of
qemuDomainPrepareDiskSourceData, just qemuDomainPrepareDiskSourceLegacy
ensures that disk isn't NULL (and not explicitly, more like a side effect of qemuDomainValidateStorageSource being used with disk->src there). In all other places there is no guard of disk == NULL.

Or perhaps disk=NULL never happens in the current usage of this function and I'm being pendant. Anyway ....



Reviewed-by: Daniel Henrique Barboza <danielhb413@xxxxxxxxx>


  src/qemu/qemu_domain.c | 3 +++
  1 file changed, 3 insertions(+)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 259cf51e2b..3deb69cb63 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -15095,6 +15095,9 @@ void
  qemuDomainPrepareDiskSourceData(virDomainDiskDefPtr disk,
                                  virStorageSourcePtr src)
  {
+    if (!disk)
+        return;
+
      /* transfer properties valid only for the top level image */
      if (src == disk->src)
          src->detect_zeroes = disk->detect_zeroes;


--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux