... ("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 <jbeulich@suse.com>
---
v2: Add comment.
--- a/xen/arch/x86/cpu/mcheck/mce.c
+++ b/xen/arch/x86/cpu/mcheck/mce.c
@@ -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)
On 2026-05-18 11:51, Jan Beulich wrote:
> ... ("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.
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
> ---
> v2: Add comment.
>
> --- a/xen/arch/x86/cpu/mcheck/mce.c
> +++ b/xen/arch/x86/cpu/mcheck/mce.c
> @@ -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)
--
Nicola Vetrini, B.Sc.
Software Engineer
BUGSENG (https://bugseng.com)
LinkedIn: https://www.linkedin.com/in/nicola-vetrini-a42471253
On 18.05.2026 16:35, Nicola Vetrini wrote:
> On 2026-05-18 11:51, Jan Beulich wrote:
>> ... ("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.
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> Reviewed-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
Thanks.
Jan
© 2016 - 2026 Red Hat, Inc.