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

Re: [PATCH] x86: Address MISRA Rule 13.6



On 02/04/24 17:54, Andrew Cooper wrote:
On 02/04/2024 4:46 pm, Jan Beulich wrote:
On 02.04.2024 17:43, Andrew Cooper wrote:
MISRA Rule 13.6 doesn't like having an expression in a sizeof() which
potentially has side effects.

Address several violations by pulling the expression out into a local
variable.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
with one caveat:

--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -1150,8 +1150,9 @@ static void cf_check irq_guest_eoi_timer_fn(void *data)
      {
          struct domain *d = action->guest[i];
          unsigned int pirq = domain_irq_to_pirq(d, irq);
+        struct pirq *pirq_info = pirq_info(d, pirq);
Misra won't like the var's name matching the macro's. Can we go with just
"info"?

Ah - missed that.

I can name it to just info, but I considered "struct pirq *info" to be a
little odd.

The local variable is a non-callable entity;
"clashes" between function-like macros and non-callable entities
will be deviated (as agreed during MISRA meetings).

--
Federico Serafini, M.Sc.

Software Engineer, BUGSENG (http://bugseng.com)



 


Rackspace

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