[libvirt] [PATCH 26/30] security: selinux: Drop !parent handling in SetImageLabelInternal

Cole Robinson crobinso at redhat.com
Mon Oct 7 21:49:40 UTC 2019


The only caller always passes in a non-null parent

Signed-off-by: Cole Robinson <crobinso at redhat.com>
---
 src/security/security_selinux.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
index 9d28bc5773..e384542c49 100644
--- a/src/security/security_selinux.c
+++ b/src/security/security_selinux.c
@@ -1849,9 +1849,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)
@@ -1863,7 +1862,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) {
-- 
2.23.0




More information about the libvir-list mailing list