The .probe member of virSecurityDriver struct is declared to
return virSecurityDriverStatus enum. But there are two instances
(AppArmorSecurityManagerProbe() and
virSecuritySELinuxDriverProbe()) where callbacks are defined to
return an integer. This is an undefined behavior because integer
has strictly bigger space of possible values than the enum.
Defined those aforementioned callbacks so that they return the
correct enum instead of int.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/security/security_apparmor.c | 2 +-
src/security/security_selinux.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/security/security_apparmor.c b/src/security/security_apparmor.c
index c1dc859751..27184aef7f 100644
--- a/src/security/security_apparmor.c
+++ b/src/security/security_apparmor.c
@@ -315,7 +315,7 @@ AppArmorSetSecurityHostLabel(virSCSIVHostDevice *dev G_GNUC_UNUSED,
}
/* Called on libvirtd startup to see if AppArmor is available */
-static int
+static virSecurityDriverStatus
AppArmorSecurityManagerProbe(const char *virtDriver G_GNUC_UNUSED)
{
g_autofree char *template_qemu = NULL;
diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
index aaec34ff8b..e29f627bc2 100644
--- a/src/security/security_selinux.c
+++ b/src/security/security_selinux.c
@@ -1039,7 +1039,7 @@ virSecuritySELinuxReserveLabel(virSecurityManager *mgr,
}
-static int
+static virSecurityDriverStatus
virSecuritySELinuxDriverProbe(const char *virtDriver)
{
if (is_selinux_enabled() <= 0)
--
2.43.2