]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
security: selinux: Drop !parent handling in SetImageLabelInternal
authorCole Robinson <crobinso@redhat.com>
Mon, 7 Oct 2019 19:53:27 +0000 (15:53 -0400)
committerCole Robinson <crobinso@redhat.com>
Fri, 11 Oct 2019 18:25:59 +0000 (14:25 -0400)
The only caller always passes in a non-null parent

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
src/security/security_selinux.c

index 14b791722546fa897eff44176d0c2fcb6cc455b9..fe6551331704350b2994d71747f335d79c6118c3 100644 (file)
@@ -1851,9 +1851,8 @@ virSecuritySELinuxSetImageLabelInternal(virSecurityManagerPtr mgr,
 
     disk_seclabel = virStorageSourceGetSecurityLabelDef(src,
                                                         SECURITY_SELINUX_NAME);
-    if (parent)
-        parent_seclabel = virStorageSourceGetSecurityLabelDef(parent,
-                                                              SECURITY_SELINUX_NAME);
+    parent_seclabel = virStorageSourceGetSecurityLabelDef(parent,
+                                                          SECURITY_SELINUX_NAME);
 
     if (disk_seclabel && (!disk_seclabel->relabel || disk_seclabel->label)) {
         if (!disk_seclabel->relabel)
@@ -1865,7 +1864,7 @@ virSecuritySELinuxSetImageLabelInternal(virSecurityManagerPtr mgr,
             return 0;
 
         use_label = parent_seclabel->label;
-    } else if (!parent || parent == src) {
+    } else if (parent == src) {
         if (src->shared) {
             use_label = data->file_context;
         } else if (src->readonly) {