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

Re: [PATCH v3] misra: consider conversion from UL or (void*) to function pointer as safe


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
  • Date: Fri, 17 Oct 2025 09:09:02 +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=1760684942; h=DKIM-Signature:MIME-Version:Date:From:To:Cc:Subject:In-Reply-To: References:Message-ID:X-Sender:Organization:Content-Type: Content-Transfer-Encoding; bh=uOLU68QL+B1cd2TjzJ1O64c9poVxHBQFTgYc+mgv57E=; b=R1x3hh/ggebYXYorO/sECJfl9yT0knAOiEzkVSvV5lfH09a5hfRhLXU+Oo5AJpFuOK+K zqWx7QwI/OUpBm+/M3bkQE3bcssazdnaDPS4TJU9Q0tHDlAa8qTFaJk+MSkfg/u/J3OIe pVEABSkG64u65WNxEmovfh5gj2h1JS7r7q3NReL8oIZcjMsFmabwehzgyHiUj/KJZS+UR rfdVc2oyklavtjd/G1OXbr2S9yU2iNN03Uo8cxne7R19MU4poboTq6iv2EaF8AUomATcW 4w17UoX2O61Jzu5C/QJSnKqT4JbrvzH02Lj9J8eYAGVgvqsLbpfuGXC0DHXShlt+g99L1 RrCi7KFg4PZ7KvJj6TeaEU6mMfmukzVsXS7Loaz7i5MdHs8U0nGz5zlFWh3eWaVH3RBeD t0RIyIlf7lSDIn/f4xEh9x7LD7tohMYoIhluKPK4IkNGSCpzHgGDj346rN4c7t6pkpePU NoHOYzDCWrp90XIIcxp4aQDl5/yVcvC4oAfF3krwvyDgDgmE10hJfdi5od9nmFxe2VqSE ezu/9lfrPkCXwLUESxbC4NhGSKhi7Wy5AIf+ZjH+1crEppte0abrxLgET1F0StQQ6IGIn zgxMg7j7Iyvet/p6wwQ9mOeP9HRuj3CE9HkfxREW1yUGHcJymPsU/pjxXbOM2bA=
  • Arc-seal: i=1; d=bugseng.com; s=openarc; a=rsa-sha256; cv=none; t=1760684942; b=rukfvWtCQPfyuqglTgiLPcowOTzCmRi5mRfjpVOEnwOAGNbhn+PsOEgybjj++AzKI4kP h+vUGVPMQc+Dn1V05VqWddD+XIgIUQisgh+5vIfA8G1gbxctU/ng76B1DP3LqQB8iRNkJ Z8UnwiCbTiXaqAn0p3EOoiJ2EbhyRs7V1vQACk0bVsMX6ZWXS9TU0iPmyfA2ztzaqAbwY R/+uUJDQP5Nxc7lSKON0+8+mdUXgZj1B81VJjJdc8TIZDmUTBfkkSIZuVaa3VjkqjNTag USS3uYIzlbppekgiO4AzjUIrqjWRcoVaCs/Vx6/Ee8APgRXUKUbxDkkPTRGuh5m/t5zuZ XbDdzlT0//DrjzXtXudftOCcYaPVMdgThAjH/kAQL/JsZslRriUUi2FFV0nRvOj9LvKbG sFxoQ5K1Z0xkfctV6J4ccEG0p5SMd42DtdYgg+SSVq024kapmFiEBd1zmz+euSCCVEnAo 29sgmXC+PiYEImVRFDpb/YDjFdHbR4sOYrO4BOE/iP5PoQ+e0r2NWgG4wrnHDXPWP0haG uHQw+NkK4k79WmzbKcKUcToQ94igC/Zf0AsKUfqvzU4CiZq5+nzRD+lpqbSzRqKsZj2WY mLIbX9qZfpDMDCAY7XODUaBfXpjiLuxYIndADUOeSSe4NK/a905NlHiAZYKyxwQ=
  • Authentication-results: bugseng.com; arc=none smtp.remote-ip=162.55.131.47
  • Cc: Dmytro Prokopchuk1 <dmytro_prokopchuk1@xxxxxxxx>, Doug Goldstein <cardoe@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Julien Grall <julien@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Fri, 17 Oct 2025 07:09:18 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 2025-10-15 08:20, Jan Beulich wrote:
On 14.10.2025 18:16, Dmytro Prokopchuk1 wrote:
--- a/xen/common/version.c
+++ b/xen/common/version.c
@@ -217,6 +217,20 @@ void __init xen_build_init(void)
 #endif /* CONFIG_X86 */
 }
 #endif /* BUILD_ID */
+
+#if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || defined(__aarch64__)

Why __i386__? Also (nit): Line too long.

And why this restriction without any comment here or ...

+static void __init __maybe_unused build_assertions(void)
+{
+    /*
+ * To confirm conversion compatibility between unsigned long, (void *)
+     * and function pointers for X86 and ARM architectures only.

... explanation here? More generally - how would people know to update
the condition if another port was to be certified?

Finally, with the v3 addition here, is Nicola's R-b really still applicable?


I agree with the point you make about i386 (e.g., C-language-toolchain.rst may be mentioned to provide some context about the preprocessor guard); that said, my R-by can be retained

Jan

+     */
+
+    BUILD_BUG_ON(sizeof(unsigned long) != sizeof(void (*)(void)));
+    BUILD_BUG_ON(sizeof(void *) != sizeof(void (*)(void)));
+}
+#endif
+
 /*
  * Local variables:
  * mode: C

--
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®.