]> xenbits.xensource.com Git - people/aperard/xen-unstable.git/commitdiff
x86/hvm: address violations of Rule 20.7
authorNicola Vetrini <nicola.vetrini@bugseng.com>
Wed, 27 Mar 2024 08:12:30 +0000 (09:12 +0100)
committerJan Beulich <jbeulich@suse.com>
Wed, 27 Mar 2024 08:12:30 +0000 (09:12 +0100)
MISRA C Rule 20.7 states: "Expressions resulting from the expansion
of macro parameters shall be enclosed in parentheses". Therefore, some
macro definitions should either gain additional parentheses or have
their expressions simplified to ensure that all current and future users
will be safe with respect to expansions that can possibly alter the
semantics of the passed-in macro parameter.

No functional change.

Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/hvm/hvm.c
xen/arch/x86/include/asm/hvm/save.h

index c75959588c0e31c9b4fc468650b14169d3734707..0ce45b177cf46085723e3b33bf5175125c2f82a9 100644 (file)
@@ -1066,9 +1066,9 @@ static int cf_check hvm_load_cpu_ctxt(struct domain *d, hvm_domain_context_t *h)
     /* Older Xen versions used to save the segment arbytes directly 
      * from the VMCS on Intel hosts.  Detect this and rearrange them
      * into the struct segment_register format. */
-#define UNFOLD_ARBYTES(_r)                          \
-    if ( (_r & 0xf000) && !(_r & 0x0f00) )          \
-        _r = ((_r & 0xff) | ((_r >> 4) & 0xf00))
+#define UNFOLD_ARBYTES(_r)                              \
+    if ( ((_r) & 0xf000) && !((_r) & 0x0f00) )          \
+        (_r) = (((_r) & 0xff) | (((_r) >> 4) & 0xf00))
     UNFOLD_ARBYTES(ctxt.cs_arbytes);
     UNFOLD_ARBYTES(ctxt.ds_arbytes);
     UNFOLD_ARBYTES(ctxt.es_arbytes);
index 04a47ffcc40a85e19acb7bac9a725d9aafbc2537..8149aa113cb4f75870db1a40e68648921c6aa7af 100644 (file)
@@ -128,9 +128,9 @@ static int __init cf_check __hvm_register_##_x##_save_and_restore(void)   \
 {                                                                         \
     hvm_register_savevm(HVM_SAVE_CODE(_x),                                \
                         #_x,                                              \
-                        &_save,                                           \
+                        _save,                                            \
                         check,                                            \
-                        &_load,                                           \
+                        _load,                                            \
                         (_num) * (HVM_SAVE_LENGTH(_x)                     \
                                   + sizeof (struct hvm_save_descriptor)), \
                         _k);                                              \