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

[Xen-devel] [PATCH 3/3] XSM/flask: constification of IRQ mapping interfaces



This clarifies that the involved structures are read-only.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

--- a/xen/include/xsm/dummy.h
+++ b/xen/include/xsm/dummy.h
@@ -445,7 +445,8 @@ static XSM_INLINE int xsm_map_domain_pir
     return xsm_default_action(action, current->domain, d);
 }
 
-static XSM_INLINE int xsm_map_domain_irq(XSM_DEFAULT_ARG struct domain *d, int 
irq, void *data)
+static XSM_INLINE int xsm_map_domain_irq(XSM_DEFAULT_ARG struct domain *d,
+                                         int irq, const void *data)
 {
     XSM_ASSERT_ACTION(XSM_HOOK);
     return xsm_default_action(action, current->domain, d);
@@ -469,7 +470,8 @@ static XSM_INLINE int xsm_unbind_pt_irq(
     return xsm_default_action(action, current->domain, d);
 }
 
-static XSM_INLINE int xsm_unmap_domain_irq(XSM_DEFAULT_ARG struct domain *d, 
int irq, void *data)
+static XSM_INLINE int xsm_unmap_domain_irq(XSM_DEFAULT_ARG struct domain *d,
+                                           int irq, const void *data)
 {
     XSM_ASSERT_ACTION(XSM_HOOK);
     return xsm_default_action(action, current->domain, d);
--- a/xen/include/xsm/xsm.h
+++ b/xen/include/xsm/xsm.h
@@ -97,9 +97,9 @@ struct xsm_operations {
 
     char *(*show_irq_sid) (int irq);
     int (*map_domain_pirq) (struct domain *d);
-    int (*map_domain_irq) (struct domain *d, int irq, void *data);
+    int (*map_domain_irq) (struct domain *d, int irq, const void *data);
     int (*unmap_domain_pirq) (struct domain *d);
-    int (*unmap_domain_irq) (struct domain *d, int irq, void *data);
+    int (*unmap_domain_irq) (struct domain *d, int irq, const void *data);
     int (*bind_pt_irq) (struct domain *d, struct xen_domctl_bind_pt_irq *bind);
     int (*unbind_pt_irq) (struct domain *d, struct xen_domctl_bind_pt_irq 
*bind);
     int (*irq_permission) (struct domain *d, int pirq, uint8_t allow);
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -877,13 +877,13 @@ static int flask_map_domain_pirq (struct
     return current_has_perm(d, SECCLASS_RESOURCE, RESOURCE__ADD);
 }
 
-static int flask_map_domain_msi (struct domain *d, int irq, void *data,
+static int flask_map_domain_msi (struct domain *d, int irq, const void *data,
                                  u32 *sid, struct avc_audit_data *ad)
 {
 #ifdef CONFIG_HAS_PCI
-    struct msi_info *msi = data;
-
+    const struct msi_info *msi = data;
     u32 machine_bdf = (msi->seg << 16) | (msi->bus << 8) | msi->devfn;
+
     AVC_AUDIT_DATA_INIT(ad, DEV);
     ad->device = machine_bdf;
 
@@ -912,7 +912,7 @@ static u32 flask_iommu_resource_use_perm
     return perm;
 }
 
-static int flask_map_domain_irq (struct domain *d, int irq, void *data)
+static int flask_map_domain_irq (struct domain *d, int irq, const void *data)
 {
     u32 sid, dsid;
     int rc = -EPERM;
@@ -943,7 +943,7 @@ static int flask_unmap_domain_pirq (stru
     return current_has_perm(d, SECCLASS_RESOURCE, RESOURCE__REMOVE);
 }
 
-static int flask_unmap_domain_msi (struct domain *d, int irq, void *data,
+static int flask_unmap_domain_msi (struct domain *d, int irq, const void *data,
                                    u32 *sid, struct avc_audit_data *ad)
 {
 #ifdef CONFIG_HAS_PCI
@@ -959,7 +959,7 @@ static int flask_unmap_domain_msi (struc
 #endif
 }
 
-static int flask_unmap_domain_irq (struct domain *d, int irq, void *data)
+static int flask_unmap_domain_irq (struct domain *d, int irq, const void *data)
 {
     u32 sid;
     int rc = -EPERM;




_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.