]> xenbits.xensource.com Git - people/aperard/xen-unstable.git/commitdiff
xen: address MISRA C Rule 20.7 violation in generated hypercall
authorNicola Vetrini <nicola.vetrini@bugseng.com>
Wed, 27 Mar 2024 08:11:03 +0000 (09:11 +0100)
committerJan Beulich <jbeulich@suse.com>
Wed, 27 Mar 2024 08:11:03 +0000 (09:11 +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 gain additional parentheses 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>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/scripts/gen_hypercall.awk

index 9f7cfa298a6d00c914e62ab972b89e1e90683664..1a7e051fde1070ae0b85f7f055b47a55180d6b30 100644 (file)
@@ -277,7 +277,7 @@ END {
                         if (call[i] == ca && call_prio[i] == p_list[pl]) {
                             fnd++;
                             if (fnd == 1)
-                                printf("        if ( num == __HYPERVISOR_%s ) \\\n", fn[call_fn[i]]);
+                                printf("        if ( (num) == __HYPERVISOR_%s ) \\\n", fn[call_fn[i]]);
                             else
                                 printf("        else \\\n");
                             do_call(call_fn[i], call_p[i]);
@@ -290,7 +290,7 @@ END {
             } else {
                 for (i = 1; i <= nc; i++)
                     if (call[i] == ca && call_prio[i] == p_list[pl]) {
-                        printf("if ( likely(num == __HYPERVISOR_%s) ) \\\n", fn[call_fn[i]]);
+                        printf("if ( likely((num) == __HYPERVISOR_%s) ) \\\n", fn[call_fn[i]]);
                         do_call(call_fn[i], call_p[i]);
                     }
             }