]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
apparmor: Drop needless check in AppArmorSetMemoryLabel()
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 4 Dec 2020 15:04:16 +0000 (16:04 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 4 Dec 2020 16:01:42 +0000 (17:01 +0100)
The AppArmorSetMemoryLabel() is a callback that is called from
qemuSecuritySetMemoryLabel() which never passes NULL as @mem.
Therefore, there is no need to check whether @mem is NULL. Also,
no other driver does that and just dereference it immediately.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/security/security_apparmor.c

index eed66e460f97457a81f885250d06f3fa50f8fd39..1b035cce2fcb45f307b6b1fc95ca7e303b156938 100644 (file)
@@ -681,9 +681,6 @@ AppArmorSetMemoryLabel(virSecurityManagerPtr mgr,
                        virDomainDefPtr def,
                        virDomainMemoryDefPtr mem)
 {
-    if (mem == NULL)
-        return 0;
-
     switch (mem->model) {
     case VIR_DOMAIN_MEMORY_MODEL_NVDIMM:
         if (!virFileExists(mem->nvdimmPath)) {