diff mbox series

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

Message ID e0c216f6be5e7289fcd909257e95baf314b400a7.1570482718.git.crobinso@redhat.com
State Accepted
Commit 65181d419e3cc48873bfb5dbd7a885dd4f45119b
Headers show
Series storagefile, security: qcow2 data_file support | expand

Commit Message

Cole Robinson Oct. 7, 2019, 9:49 p.m. UTC
The only caller always passes in a non-null parent

Signed-off-by: Cole Robinson <crobinso@redhat.com>

---
 src/security/security_selinux.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

-- 
2.23.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Comments

Daniel Henrique Barboza Oct. 10, 2019, 4:05 p.m. UTC | #1
On 10/7/19 6:49 PM, Cole Robinson wrote:
> The only caller always passes in a non-null parent

>

> Signed-off-by: Cole Robinson <crobinso@redhat.com>

> ---


A replay from patch 20. I wonder how much common code there are
between security_dac.c and security_selinux.c.


Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.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) {


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
diff mbox series

Patch

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) {