[PATCH 00/17] conf: Fix and prevent uninitialized memory use with new virXMLProp* helpers

Peter Krempa pkrempa at redhat.com
Thu May 6 15:30:52 UTC 2021


Compilers aren't able to see that the value passed via a pointer from
the new virXMLProp helpers may be uninitialized in certain cases.

Fix 3 such cases, prepare the code and then ensure that the new
virXMLProp* helpers always initialize the memory.

CI pipeline (once it finishes) can be viewed at:

https://gitlab.com/pipo.sk/libvirt/-/pipelines/298562552


Peter Krempa (17):
  util: xml: Extract implementation of xml property -> enum parsing to a
    common helper
  virXMLPropULongLong: Always initialize @result
  virDomainVcpuParse: Assign default vcpus count based on return value
    of virXMLPropUInt
  virDomainDiskDefDriverParseXML: Fix usage of virXMLPropUInt
  virXMLPropUInt: Always initialize @result
  conf: Define autoptr func for virDomainIOThreadIDDef
  virDomainIOThreadIDDefParseXML: Refactor cleanup
  virXMLPropInt: Always initialize '@result'
  virDomainBackupDiskDefParseXML: Fill default backup state after
    parsing it
  virXMLPropTristateBool: Always initialize '@result'
  conf: domain: Don't initialize virTristateBool local variables used
    for virXMLPropTristateBool
  virXMLPropTristateSwitch: Always initialize '@result'
  virDomainAudioCommonParse: Fix parsing of 'format'
  virDomainVideoDefParseXML: Fix parsing of 'backend'
  util: xml: Introduce virXMLPropEnumDefault
  conf: domain: Convert virXMLPropEnum to virXMLPropEnumDefault where we
    set defaults
  virXMLPropEnum: Always initialize '@result'

 src/conf/backup_conf.c   |   5 +-
 src/conf/domain_conf.c   | 176 ++++++++++++++++++++-------------------
 src/conf/domain_conf.h   |   1 +
 src/libvirt_private.syms |   1 +
 src/util/virxml.c        | 156 +++++++++++++++++++---------------
 src/util/virxml.h        |  14 +++-
 6 files changed, 198 insertions(+), 155 deletions(-)

-- 
2.30.2




More information about the libvir-list mailing list