[PATCH] conf: fix backing store parse off-by-one

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

 



Commit 546154e parses the type attribute from a <backingStore>
element, but forgot that the earlier commit 9673418 added a
placeholder element in the same 1.2.3 release; as a result,
the C code was mistakenly allowing "none" as a type.

Similarly, the same commit allows "none" as the <format>
sub-element type, even though that has been a placeholder
since the 0.10.2 release with commit f772b3d.

* src/conf/domain_conf.c (virDomainDiskBackingStoreParse): Require
non-zero types.

Signed-off-by: Eric Blake <eblake@xxxxxxxxxx>

---
Maybe worth addressing in a later patch: the RelaxNG grammar
currently requires a <format> and <backingStore> subelement
to any non-empty <backingStore>, and the C code matches this
requirement.  However, we should probably make both of them
optional, to represent the case where the user is requesting
that we perform a probe to complete the backing chain details.
---
 src/conf/domain_conf.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 055b979..40c385e 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -5110,7 +5110,7 @@ virDomainDiskBackingStoreParse(xmlXPathContextPtr ctxt,
     }

     backingStore->type = virStorageTypeFromString(type);
-    if (backingStore->type < 0) {
+    if (backingStore->type <= 0) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("unknown disk backing store type '%s'"), type);
         goto cleanup;
@@ -5123,7 +5123,7 @@ virDomainDiskBackingStoreParse(xmlXPathContextPtr ctxt,
     }

     backingStore->format = virStorageFileFormatTypeFromString(format);
-    if (backingStore->format < 0) {
+    if (backingStore->format <= 0) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("unknown disk backing store format '%s'"), format);
         goto cleanup;
-- 
1.7.1

--
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]