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

Re: [PATCH] x86/MCE: adjust ID2COOKIE() for Misra C:2012 rule 11.2


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
  • Date: Fri, 15 May 2026 08:33:04 +0200
  • Arc-authentication-results: i=1; bugseng.com; arc=none smtp.remote-ip=162.55.131.47
  • Arc-message-signature: i=1; d=bugseng.com; s=openarc; a=rsa-sha256; c=relaxed/relaxed; t=1778826784; h=MIME-Version:Date:From:To:Cc:Subject:In-Reply-To:References: Message-ID:X-Sender:Organization:Content-Type: Content-Transfer-Encoding; bh=74libaaE1OF76LkVcaOCBRfEKpsiBmcVPvzkbmWj3cY=; b=DWrxfYmH02AZAV0PFfCkMaKI0QfJDGYbe9IjnyovZQJBulL6nsavk5kBbSlPWQXMvti2 R3hwUZLPXJuIUPr6yV3eI9Bz3Tb6zFo2RfRG36KQ/ZBkaKNeUxlj8J2fNbW7HqiD5FlHm 4CEcH+nyxIq3P4oPpgcmYbf51b1lRfxLh0+LEi73Uc0R2aPWx44YhbxtG+6ZKAAzKk2il 358+CxZBPnFDP4+MdOyQsp4JKgHVQ8zpaWE4afSdc8Ki+QFqEmSDuwi/IIST0hJd1EAVF cI6B/NMXH2ZRsKviXwIRyJ+oY2taUGFng1a2/Hhbk7xdxjyZ8tyql2ONZ/D4Nbtmqv4ml VOM2gM7DoXqtp9PqOaYAZznhWi5rqPRXznwzHppqwlS8SAptspwcJ+06Fuyv2mIXOgAzh kxtulNCdSLCHGnov3IKCgH7QNtO9jXUssh9ZQX0UoMGWkNQUdD0utX8Q6vZQQzykHmBPj 22VtdclKXKHr4tGF5SzyLksfAy/wjB/QSDim5/Y09WN7APLJ/8SRihWbyIAn9SRMlA9s/ +ka/VHE6fTJSzvJUSamrzLHscrK9I384pdzfd7SaIHUnWyOOGkrQNn4Z/ojI7jEkn+7nO 8Ja8Z6YaGM6JM9k0iFcElmnsRNOqDNaO0e6Pqy+uUpozd/hKZmkIsnGkNkIRv+I=
  • Arc-seal: i=1; d=bugseng.com; s=openarc; a=rsa-sha256; cv=none; t=1778826784; b=okWlmnKyooXt5GyZzL7aaqBl1tdG/FuIPD89EaJg1D+HDFiUdHXwDTwZTju13LrHBtLc qHBoWJbq+VLWG2oALOpnx6CcCNi0yoxkCOyhK/HLdCeFDk3hPblgxRq7lV0fmZwhzdzNP Ayh//6zG0osCkExElQ0D0We46Lb2Myd1JwjQpnyduGSwq4lykJLnWNLpskHTps9wID3kr /eesnToQD/gPf3Okepul4cobMNh2L8yrJCCfZJRE/OM40Zre0AhOyPwlAPgykdk1frkw+ qY/PFf+NYbSTdDGACPVT8i2SPGpbFWt23ZTmZTACRUdniMbGPYqZW56ljOXXpRYh1/tWl X2yp70MKBjBhlACV2t5RKvP1itdtD1oHOkc8drYfL/oioH/DHjnRiXn3XrnXI9dB6lMaY I1ZHsJ6ielp+hFS5vDhgrFyasMMrRG8qWGF13B8Mp6ptJEyKVAGwpxhkTbZa9/XpoMnta ZoDxAhgROgyQkCFWB1XswRL43vgc/F/830mFuZl/Ivaob/bjMnTYaHXeERsxzjPM0FA9t D2cinOaQ+lwU5BRGT+V/p3xitK9nfY35SZ3V5PcY7iZ86Tior1oT7JjhMWflAQoWfty0M Be4MQfX5s+hDcPSjdUNWdsAj109hqYL9nylaMrl5fURS9iIcAIGJ42/VoCBQPvw=
  • Authentication-results: eu.smtp.expurgate.cloud; none
  • Authentication-results: bugseng.com; arc=none smtp.remote-ip=162.55.131.47
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Teddy Astie <teddy.astie@xxxxxxxxxx>
  • Delivery-date: Fri, 15 May 2026 06:43:07 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 2026-05-15 08:28, Jan Beulich wrote:
On 13.05.2026 22:47, Nicola Vetrini wrote:
On 2026-05-13 16:03, Jan Beulich wrote:
... ("Conversions shall not be performed between a pointer to an
incomplete type and any other type"): Add an intermediate cat to void
*.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
https://gitlab.com/xen-project/hardware/xen-staging/-/jobs/14351897188
(covering more than just this)

--- a/xen/arch/x86/cpu/mcheck/mce.c
+++ b/xen/arch/x86/cpu/mcheck/mce.c
@@ -1264,7 +1264,7 @@ static void cf_check __maybe_unused x86_

 #if BITS_PER_LONG == 64

-#define ID2COOKIE(id) ((mctelem_cookie_t)(id))
+#define ID2COOKIE(id) ((mctelem_cookie_t)(void *)(id))

Notwithstanding the comment from Andrew, I think a comment here could be nice to explain what it going on, otherwise the double cast looks quite
odd.

I've added

/* Two layers of casting to cover Misra C:2012 rule 11.2. */


Sounds good

Unrelated: why not contextually marking this rule as clean to prevent
regressions?

Isn't this rule (and the others my patches were targeting) marked as clean
already, hence why the allcode job fails?


Oh, you are right, I didn't check.

--
Nicola Vetrini, B.Sc.
Software Engineer
BUGSENG (https://bugseng.com)
LinkedIn: https://www.linkedin.com/in/nicola-vetrini-a42471253



 


Rackspace

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