|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH] x86/shim: adjust for Misra C:2012 rule 20.12
... ("A macro parameter used as an operand to the `#' or `##' operators,
which is itself subject to further macro replacement, shall only be used
as an operand to these operators"). Move the HVM_PARAM_ prefixes into the
macro body, to use ## on the 2nd use (each) of the macro parameter.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
I understand that this "absorbing" of prefixes isn't liked by some people,
so I'm all ears towards alternative suggestions.
https://gitlab.com/xen-project/hardware/xen-staging/-/jobs/14354119193
(also covering the 17.5 patch)
--- a/xen/arch/x86/pv/shim.c
+++ b/xen/arch/x86/pv/shim.c
@@ -116,17 +116,17 @@ void __init pv_shim_fixup_e820(void)
ASSERT(xen_guest);
-#define MARK_PARAM_RAM(p) ({ \
- rc = xen_hypercall_hvm_get_param(p, &pfn); \
- if ( rc ) \
- panic("Unable to get " #p "\n"); \
- mark_pfn_as_ram(pfn); \
- ASSERT(i < ARRAY_SIZE(reserved_pages)); \
- reserved_pages[i++].mfn = pfn; \
+#define MARK_PARAM_RAM(p) ({ \
+ rc = xen_hypercall_hvm_get_param(HVM_PARAM_ ## p, &pfn); \
+ if ( rc ) \
+ panic("Unable to get HVM_PARAM_" #p "\n"); \
+ mark_pfn_as_ram(pfn); \
+ ASSERT(i < ARRAY_SIZE(reserved_pages)); \
+ reserved_pages[i++].mfn = pfn; \
})
- MARK_PARAM_RAM(HVM_PARAM_STORE_PFN);
+ MARK_PARAM_RAM(STORE_PFN);
if ( !pv_console )
- MARK_PARAM_RAM(HVM_PARAM_CONSOLE_PFN);
+ MARK_PARAM_RAM(CONSOLE_PFN);
#undef MARK_PARAM_RAM
}
@@ -190,9 +190,9 @@ void __init pv_shim_setup_dom(struct dom
long rc;
#define SET_AND_MAP_PARAM(p, si, va) ({
\
- rc = xen_hypercall_hvm_get_param(p, ¶m);
\
+ rc = xen_hypercall_hvm_get_param(HVM_PARAM_ ## p, ¶m);
\
if ( rc )
\
- panic("Unable to get " #p "\n");
\
+ panic("Unable to get HVM_PARAM_" #p "\n");
\
(si) = param;
\
if ( va )
\
{
\
@@ -207,12 +207,11 @@ void __init pv_shim_setup_dom(struct dom
evtchn_reserve(d, param);
\
}
\
})
- SET_AND_MAP_PARAM(HVM_PARAM_STORE_PFN, si->store_mfn, store_va);
- SET_AND_MAP_PARAM(HVM_PARAM_STORE_EVTCHN, si->store_evtchn, 0);
- SET_AND_MAP_PARAM(HVM_PARAM_CONSOLE_EVTCHN, si->console.domU.evtchn, 0);
+ SET_AND_MAP_PARAM(STORE_PFN, si->store_mfn, store_va);
+ SET_AND_MAP_PARAM(STORE_EVTCHN, si->store_evtchn, 0);
+ SET_AND_MAP_PARAM(CONSOLE_EVTCHN, si->console.domU.evtchn, 0);
if ( !pv_console )
- SET_AND_MAP_PARAM(HVM_PARAM_CONSOLE_PFN, si->console.domU.mfn,
- console_va);
+ SET_AND_MAP_PARAM(CONSOLE_PFN, si->console.domU.mfn, console_va);
#undef SET_AND_MAP_PARAM
else
{
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |