The only reference of hvm_copy_context_and_params() is in
arch/x86/mm/mem_sharing.c, so it shall be wrapped with CONFIG_MEM_SHARING.
Otherwise it will become unreachable when MEM_SHARING=n, and hence violating
Misra rule 2.1.
Signed-off-by: Penny Zheng <Penny.Zheng@xxxxxxx>
---
v2 -> v3:
- new commit
---
xen/arch/x86/hvm/hvm.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 0c60faa39d..239cd992a4 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -5458,6 +5458,7 @@ void hvm_set_segment_register(struct vcpu *v, enum
x86_segment seg,
alternative_vcall(hvm_funcs.set_segment_register, v, seg, reg);
}
+#ifdef CONFIG_MEM_SHARING
int hvm_copy_context_and_params(struct domain *dst, struct domain *src)
{
struct hvm_domain_context c = { .size = hvm_save_size(src) };
@@ -5489,6 +5490,7 @@ int hvm_copy_context_and_params(struct domain *dst,
struct domain *src)
return rc;
}
+#endif /* CONFIG_MEM_SHARING */
/*
* Local variables: