]> git.ipfire.org Git - thirdparty/libvirt.git/commit
security: Fix return types of .probe callbacks
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 3 May 2024 14:32:05 +0000 (16:32 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 14 May 2024 13:11:30 +0000 (15:11 +0200)
commit1a4063ca209f84331a58e4459506647d97dda22e
tree3bdb26bb8114aed39d5d3bd00df968861d93ddee
parent0c05f336c795dd2f7c0fdbd1c40a41ba20bdee01
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>
src/security/security_apparmor.c
src/security/security_selinux.c