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

Michal Prívozník mprivozn at redhat.com
Thu May 6 17:07:57 UTC 2021


On 5/6/21 5:30 PM, Peter Krempa wrote:
> 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(-)
> 

Reviewed-by: Michal Privoznik <mprivozn at redhat.com>

Michal




More information about the libvir-list mailing list