Re: [PATCH v2] conf: add enum constants for default controller models

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

 



On Tue, Feb 20, 2018 at 10:56:31AM +0000, Daniel P. Berrangé wrote:
The controller model is slightly unusual in that the default value is
-1, not 0. As a result the default value is not covered by any of the
existing enum cases. This in turn means that any switch() statements
that think they have covered all cases, will in fact not match the
default value at all. In the qemuDomainDeviceCalculatePCIConnectFlags()
method this has caused a serious mistake where we fallthrough from the
SCSI controller case, to the VirtioSerial controller case, and from
the USB controller case to the IDE controller case.

By adding explicit enum constant starting at -1, we can ensure switches
remember to handle the default case.

Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
---
src/conf/domain_addr.c         |  6 +++---
src/conf/domain_conf.c         |  3 ++-
src/conf/domain_conf.h         |  4 ++++
src/libxl/libxl_conf.c         |  2 +-
src/qemu/qemu_command.c        | 21 ++++++++++++++++-----
src/qemu/qemu_domain.c         | 14 +++++++++++---
src/qemu/qemu_domain_address.c | 19 +++++++++++++++++--
src/qemu/qemu_hotplug.c        |  2 +-
src/vbox/vbox_common.c         | 13 +++++++++----
src/vmx/vmx.c                  |  2 +-
10 files changed, 65 insertions(+), 21 deletions(-)


ACK

Jan

Attachment: signature.asc
Description: Digital signature

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