diff options
author | Michal Privoznik <mprivozn@redhat.com> | 2023-04-25 10:00:18 +0200 |
---|---|---|
committer | Michal Privoznik <mprivozn@redhat.com> | 2023-04-25 11:00:57 +0200 |
commit | 46410c2be8cdcd31a252866e9b5ebe4d75e46c16 (patch) | |
tree | 15b40322d2f367d94d382af83606b4fd078d252b | |
parent | 537d90437cf05c502130e4b0c9d439d6efcf3950 (diff) | |
download | libvirt-46410c2be8cdcd31a252866e9b5ebe4d75e46c16.tar.gz |
lxc: Fix access to hostdev capabilities
In a few places, where a capabilities <hostdev/> is processed, a
wrong union member is access: def->source.subsys.type instead of
def->source.caps.type. Fortunately, both union members have .type
as the very first member so no real harm is done. Nevertheless,
we should access the correct union member.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
-rw-r--r-- | src/lxc/lxc_controller.c | 2 | ||||
-rw-r--r-- | src/lxc/lxc_hostdev.c | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c index 60b961dcb5..86dcd880e8 100644 --- a/src/lxc/lxc_controller.c +++ b/src/lxc/lxc_controller.c @@ -1788,7 +1788,7 @@ virLXCControllerSetupHostdevCaps(virDomainDef *vmDef, virDomainHostdevDef *def, virSecurityManager *securityDriver) { - switch (def->source.subsys.type) { + switch (def->source.caps.type) { case VIR_DOMAIN_HOSTDEV_CAPS_TYPE_STORAGE: return virLXCControllerSetupHostdevCapsStorage(vmDef, def, diff --git a/src/lxc/lxc_hostdev.c b/src/lxc/lxc_hostdev.c index d18d61cb19..8fe02a4276 100644 --- a/src/lxc/lxc_hostdev.c +++ b/src/lxc/lxc_hostdev.c @@ -85,7 +85,7 @@ int virLXCPrepareHostDevices(virLXCDriver *driver, break; case VIR_DOMAIN_HOSTDEV_MODE_CAPABILITIES: - switch (dev->source.subsys.type) { + switch (dev->source.caps.type) { case VIR_DOMAIN_HOSTDEV_CAPS_TYPE_STORAGE: case VIR_DOMAIN_HOSTDEV_CAPS_TYPE_MISC: case VIR_DOMAIN_HOSTDEV_CAPS_TYPE_NET: @@ -93,7 +93,7 @@ int virLXCPrepareHostDevices(virLXCDriver *driver, default: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Unsupported hostdev type %1$s"), - virDomainHostdevSubsysTypeToString(dev->source.subsys.type)); + virDomainHostdevSubsysTypeToString(dev->source.caps.type)); return -1; } break; |