[PATCH 08/10] security: Sanitize type of @migrated in virSecurityManagerRestoreAllLabel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Also remove one spurious ATTRIBUTE_UNUSED guarding the @migrated
argument.
---
 src/qemu/qemu_process.c          | 2 +-
 src/security/security_apparmor.c | 2 +-
 src/security/security_dac.c      | 6 +++---
 src/security/security_driver.h   | 2 +-
 src/security/security_manager.c  | 2 +-
 src/security/security_manager.h  | 2 +-
 src/security/security_nop.c      | 2 +-
 src/security/security_selinux.c  | 6 +++---
 src/security/security_stack.c    | 2 +-
 9 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index f1c0041..6af77c9 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -4419,7 +4419,7 @@ void qemuProcessStop(virQEMUDriverPtr driver,
     if (!(flags & VIR_QEMU_PROCESS_STOP_NO_RELABEL))
         virSecurityManagerRestoreAllLabel(driver->securityManager,
                                           vm->def,
-                                          flags & VIR_QEMU_PROCESS_STOP_MIGRATED);
+                                          !!(flags & VIR_QEMU_PROCESS_STOP_MIGRATED));
     virSecurityManagerReleaseLabel(driver->securityManager, vm->def);

     for (i = 0; i < vm->def->ndisks; i++) {
diff --git a/src/security/security_apparmor.c b/src/security/security_apparmor.c
index ec8c101..ed9d192 100644
--- a/src/security/security_apparmor.c
+++ b/src/security/security_apparmor.c
@@ -550,7 +550,7 @@ AppArmorReleaseSecurityLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED,
 static int
 AppArmorRestoreSecurityAllLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED,
                                 virDomainDefPtr def,
-                                int migrated ATTRIBUTE_UNUSED)
+                                bool migrated ATTRIBUTE_UNUSED)
 {
     int rc = 0;
     virSecurityLabelDefPtr secdef =
diff --git a/src/security/security_dac.c b/src/security/security_dac.c
index 28f033d..6e5ccfa 100644
--- a/src/security/security_dac.c
+++ b/src/security/security_dac.c
@@ -351,7 +351,7 @@ static int
 virSecurityDACRestoreSecurityImageLabelInt(virSecurityManagerPtr mgr,
                                            virDomainDefPtr def,
                                            virDomainDiskDefPtr disk,
-                                           int migrated)
+                                           bool migrated)
 {
     virSecurityDACDataPtr priv = virSecurityManagerGetPrivateData(mgr);
     virSecurityLabelDefPtr secdef;
@@ -414,7 +414,7 @@ virSecurityDACRestoreSecurityImageLabel(virSecurityManagerPtr mgr,
                                         virDomainDefPtr def,
                                         virDomainDiskDefPtr disk)
 {
-    return virSecurityDACRestoreSecurityImageLabelInt(mgr, def, disk, 0);
+    return virSecurityDACRestoreSecurityImageLabelInt(mgr, def, disk, false);
 }


@@ -877,7 +877,7 @@ virSecurityDACRestoreSecurityTPMFileLabel(virSecurityManagerPtr mgr,
 static int
 virSecurityDACRestoreSecurityAllLabel(virSecurityManagerPtr mgr,
                                       virDomainDefPtr def,
-                                      int migrated)
+                                      bool migrated)
 {
     virSecurityDACDataPtr priv = virSecurityManagerGetPrivateData(mgr);
     virSecurityLabelDefPtr secdef;
diff --git a/src/security/security_driver.h b/src/security/security_driver.h
index ced1b92..879f63c 100644
--- a/src/security/security_driver.h
+++ b/src/security/security_driver.h
@@ -89,7 +89,7 @@ typedef int (*virSecurityDomainSetAllLabel) (virSecurityManagerPtr mgr,
                                              const char *stdin_path);
 typedef int (*virSecurityDomainRestoreAllLabel) (virSecurityManagerPtr mgr,
                                                  virDomainDefPtr def,
-                                                 int migrated);
+                                                 bool migrated);
 typedef int (*virSecurityDomainGetProcessLabel) (virSecurityManagerPtr mgr,
                                                  virDomainDefPtr def,
                                                  pid_t pid,
diff --git a/src/security/security_manager.c b/src/security/security_manager.c
index 79edb07..715159c 100644
--- a/src/security/security_manager.c
+++ b/src/security/security_manager.c
@@ -593,7 +593,7 @@ int virSecurityManagerSetAllLabel(virSecurityManagerPtr mgr,

 int virSecurityManagerRestoreAllLabel(virSecurityManagerPtr mgr,
                                       virDomainDefPtr vm,
-                                      int migrated)
+                                      bool migrated)
 {
     if (mgr->drv->domainRestoreSecurityAllLabel) {
         int ret;
diff --git a/src/security/security_manager.h b/src/security/security_manager.h
index 81d3160..3cddcd2 100644
--- a/src/security/security_manager.h
+++ b/src/security/security_manager.h
@@ -99,7 +99,7 @@ int virSecurityManagerSetAllLabel(virSecurityManagerPtr mgr,
                                   const char *stdin_path);
 int virSecurityManagerRestoreAllLabel(virSecurityManagerPtr mgr,
                                       virDomainDefPtr def,
-                                      int migrated);
+                                      bool migrated);
 int virSecurityManagerGetProcessLabel(virSecurityManagerPtr mgr,
                                       virDomainDefPtr def,
                                       pid_t pid,
diff --git a/src/security/security_nop.c b/src/security/security_nop.c
index 73e1ac1..a096ce2 100644
--- a/src/security/security_nop.c
+++ b/src/security/security_nop.c
@@ -139,7 +139,7 @@ static int virSecurityDomainSetAllLabelNop(virSecurityManagerPtr mgr ATTRIBUTE_U

 static int virSecurityDomainRestoreAllLabelNop(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED,
                                                virDomainDefPtr vm ATTRIBUTE_UNUSED,
-                                               int migrated ATTRIBUTE_UNUSED)
+                                               bool migrated ATTRIBUTE_UNUSED)
 {
     return 0;
 }
diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
index 0c34af8..f5d67a9 100644
--- a/src/security/security_selinux.c
+++ b/src/security/security_selinux.c
@@ -1124,7 +1124,7 @@ static int
 virSecuritySELinuxRestoreSecurityImageLabelInt(virSecurityManagerPtr mgr,
                                                virDomainDefPtr def,
                                                virDomainDiskDefPtr disk,
-                                               int migrated)
+                                               bool migrated)
 {
     virSecurityLabelDefPtr seclabel;
     virSecurityDeviceLabelDefPtr disk_seclabel;
@@ -1186,7 +1186,7 @@ virSecuritySELinuxRestoreSecurityImageLabel(virSecurityManagerPtr mgr,
                                             virDomainDefPtr def,
                                             virDomainDiskDefPtr disk)
 {
-    return virSecuritySELinuxRestoreSecurityImageLabelInt(mgr, def, disk, 0);
+    return virSecuritySELinuxRestoreSecurityImageLabelInt(mgr, def, disk, false);
 }


@@ -1837,7 +1837,7 @@ virSecuritySELinuxGetBaseLabel(virSecurityManagerPtr mgr, int virtType)
 static int
 virSecuritySELinuxRestoreSecurityAllLabel(virSecurityManagerPtr mgr,
                                           virDomainDefPtr def,
-                                          int migrated ATTRIBUTE_UNUSED)
+                                          bool migrated)
 {
     virSecurityLabelDefPtr secdef;
     virSecuritySELinuxDataPtr data = virSecurityManagerGetPrivateData(mgr);
diff --git a/src/security/security_stack.c b/src/security/security_stack.c
index e4b2db6..355c978 100644
--- a/src/security/security_stack.c
+++ b/src/security/security_stack.c
@@ -323,7 +323,7 @@ virSecurityStackSetSecurityAllLabel(virSecurityManagerPtr mgr,
 static int
 virSecurityStackRestoreSecurityAllLabel(virSecurityManagerPtr mgr,
                                         virDomainDefPtr vm,
-                                        int migrated)
+                                        bool migrated)
 {
     virSecurityStackDataPtr priv = virSecurityManagerGetPrivateData(mgr);
     virSecurityStackItemPtr item = priv->itemsHead;
-- 
1.9.3

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




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]