x86/MCE: adjust ID2COOKIE() for Misra C:2012 rule 11.2
PATCH v2 1/1 x86/MCE: adjust ID2COOKIE() for Misra C:2012 rule 11.2
... ("Conversions shall not be performed between a pointer to an incomplete type and any other type"): Add an intermediate cast to unsigned long.
Signed-off-by Jan Beulich <[email protected]>
---
v2: Add comment.
xen/arch/x86/cpu/mcheck/mce.c +2 -1
@@ -1264,7 +1264,8 @@ static void cf_check __maybe_unused x86_#if BITS_PER_LONG ==64 -#define ID2COOKIE (id) ((mctelem_cookie_t)(id)) +/* Two layers of casting to cover Misra C:2012 rule 11.2. */ +#define ID2COOKIE (id) ((mctelem_cookie_t)(void *)(id))#define COOKIE2ID (c) ((uint64_t)(c))#elif defined(BITS_PER_LONG )
Quoted 4 lines · Jan Beulich
... ("Conversions shall not be performed between a pointer to an incomplete type and any other type"): Add an intermediate cast to unsigned long.
Stale comment I presume.
Quoted 1 line
Signed-off-by Jan Beulich <[email protected]>
Reviewed-by Nicola Vetrini <[email protected]>
Quoted 15 lines
---
v2: Add comment.xen/arch/x86/cpu/mcheck/mce.c +2
-1@@ -1264,7 +1264,8 @@ static void cf_check __maybe_unused x86_#if BITS_PER_LONG ==64 -#define ID2COOKIE (id) ((mctelem_cookie_t)(id)) +/* Two layers of casting to cover Misra C:2012 rule 11.2. */ +#define ID2COOKIE (id) ((mctelem_cookie_t)(void *)(id))#define COOKIE2ID (c) ((uint64_t)(c))#elif defined(BITS_PER_LONG )
Signature · 4 lines
Nicola Vetrini, B.Sc. Software Engineer BUGSENG (https://bugseng.com) LinkedIn: https://www.linkedin.com/in/nicola-vetrini-a42471253
Quoted 6 lines · Nicola Vetrini
Quoted 3 lines · Jan Beulich
... ("Conversions shall not be performed between a pointer to an incomplete type and any other type"): Add an intermediate cast to unsigned long.
Stale comment I presume.
Indeed, forgot to edit it again after the failed attempt.
Quoted 2 lines
Quoted 1 line
Signed-off-by Jan Beulich <[email protected]>Reviewed-by Nicola Vetrini <[email protected]>
Thanks.
Jan