mirror of
https://github.com/libvirt/libvirt.git
synced 2026-09-03 20:53:04 -05:00
security: Fix return types of .probe callbacks
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@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
@@ -315,7 +315,7 @@ AppArmorSetSecurityHostLabel(virSCSIVHostDevice *dev G_GNUC_UNUSED,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Called on libvirtd startup to see if AppArmor is available */
|
/* Called on libvirtd startup to see if AppArmor is available */
|
||||||
static int
|
static virSecurityDriverStatus
|
||||||
AppArmorSecurityManagerProbe(const char *virtDriver G_GNUC_UNUSED)
|
AppArmorSecurityManagerProbe(const char *virtDriver G_GNUC_UNUSED)
|
||||||
{
|
{
|
||||||
g_autofree char *template_qemu = NULL;
|
g_autofree char *template_qemu = NULL;
|
||||||
|
|||||||
@@ -1039,7 +1039,7 @@ virSecuritySELinuxReserveLabel(virSecurityManager *mgr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static virSecurityDriverStatus
|
||||||
virSecuritySELinuxDriverProbe(const char *virtDriver)
|
virSecuritySELinuxDriverProbe(const char *virtDriver)
|
||||||
{
|
{
|
||||||
if (is_selinux_enabled() <= 0)
|
if (is_selinux_enabled() <= 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user