mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 03:25:20 +00: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:
parent
0c05f336c7
commit
1a4063ca20
@ -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;
|
||||
|
@ -1039,7 +1039,7 @@ virSecuritySELinuxReserveLabel(virSecurityManager *mgr,
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
static virSecurityDriverStatus
|
||||
virSecuritySELinuxDriverProbe(const char *virtDriver)
|
||||
{
|
||||
if (is_selinux_enabled() <= 0)
|
||||
|
Loading…
Reference in New Issue
Block a user