Function xsm_set_target() is only invoked under XEN_DOMCTL_set_target
domctl-op, and shall be wrapped.

Signed-off-by: Penny Zheng <penny.zh...@amd.com>
---
 xen/include/xsm/xsm.h | 4 ++++
 xen/xsm/dummy.c       | 2 ++
 xen/xsm/flask/hooks.c | 4 ++++
 3 files changed, 10 insertions(+)

diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h
index 1759d49aaa..55f8d0903e 100644
--- a/xen/include/xsm/xsm.h
+++ b/xen/include/xsm/xsm.h
@@ -62,7 +62,9 @@ struct xsm_ops {
 #ifdef CONFIG_SYSCTL
     int (*sysctl_scheduler_op)(int op);
 #endif
+#ifdef CONFIG_DOMCTL
     int (*set_target)(struct domain *d, struct domain *e);
+#endif
     int (*domctl)(struct domain *d, unsigned int cmd, uint32_t ssidref);
     int (*sysctl)(int cmd);
     int (*readconsole)(uint32_t clear);
@@ -261,11 +263,13 @@ static inline int xsm_sysctl_scheduler_op(xsm_default_t 
def, int cmd)
 }
 #endif
 
+#ifdef CONFIG_DOMCTL
 static inline int xsm_set_target(
     xsm_default_t def, struct domain *d, struct domain *e)
 {
     return alternative_call(xsm_ops.set_target, d, e);
 }
+#endif
 
 static inline int xsm_domctl(xsm_default_t def, struct domain *d,
                              unsigned int cmd, uint32_t ssidref)
diff --git a/xen/xsm/dummy.c b/xen/xsm/dummy.c
index 2798425de2..cd5358dd1e 100644
--- a/xen/xsm/dummy.c
+++ b/xen/xsm/dummy.c
@@ -24,7 +24,9 @@ static const struct xsm_ops __initconst_cf_clobber dummy_ops 
= {
 #ifdef CONFIG_SYSCTL
     .sysctl_scheduler_op           = xsm_sysctl_scheduler_op,
 #endif
+#ifdef CONFIG_DOMCTL
     .set_target                    = xsm_set_target,
+#endif
     .domctl                        = xsm_domctl,
 #ifdef CONFIG_SYSCTL
     .sysctl                        = xsm_sysctl,
diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
index 8361cf94f9..2975d2906f 100644
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -645,6 +645,7 @@ static int cf_check flask_sysctl_scheduler_op(int op)
 }
 #endif /* CONFIG_SYSCTL */
 
+#ifdef CONFIG_DOMCTL
 static int cf_check flask_set_target(struct domain *d, struct domain *t)
 {
     int rc;
@@ -668,6 +669,7 @@ static int cf_check flask_set_target(struct domain *d, 
struct domain *t)
                                  &dsec->target_sid);
     return rc;
 }
+#endif /* CONFIG_DOMCTL */
 
 static int cf_check flask_domctl(struct domain *d, unsigned int cmd,
                                  uint32_t ssidref)
@@ -1900,7 +1902,9 @@ static const struct xsm_ops __initconst_cf_clobber 
flask_ops = {
 #ifdef CONFIG_SYSCTL
     .sysctl_scheduler_op = flask_sysctl_scheduler_op,
 #endif
+#ifdef CONFIG_DOMCTL
     .set_target = flask_set_target,
+#endif
     .domctl = flask_domctl,
 #ifdef CONFIG_SYSCTL
     .sysctl = flask_sysctl,
-- 
2.34.1


Reply via email to