[PATCH] apparmor: Drop needless check in AppArmorSetMemoryLabel()

Michal Privoznik mprivozn at redhat.com
Fri Dec 4 15:31:03 UTC 2020


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 at redhat.com>
---
 src/security/security_apparmor.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/src/security/security_apparmor.c b/src/security/security_apparmor.c
index eed66e460f..1b035cce2f 100644
--- a/src/security/security_apparmor.c
+++ b/src/security/security_apparmor.c
@@ -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)) {
-- 
2.26.2




More information about the libvir-list mailing list