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

Re: [PATCH v2] misra: add deviation of Rule 17.7


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
  • Date: Tue, 26 Aug 2025 09:56:25 +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=1756194985; 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=2a34Nk9dEAydgyzZvGZr7cQoriBy4lEgOXv122koJ+o=; b=jdNVHBmJsSsJWvXy7fwEPHHuh/qufVnwbNRyYsdjT4VgVBTrD8YtGypwaEpNKrAaJrD2 TZRcP0+Zist2lAEl1vVKob+ZRR9fjfUyr5mgYWTeb9seNDIlEyWg4jhsz/zwqk8FpWV9F 59ERV/hoeAewoGS0/FgTMUd/TDhj/n84ows6Y67GpWgoSN3nZtCutWPxufKnpDz0eUPUP VDVS194esfWJIja1ovr23Tf/l/njNx5baWCCG9scqrj0T/7FUJo0dV80vlwfdKsmkK1kH x/CDwieHNW0CoyC0yD/LYC51BLiuNbCAVN4C13Rvb7fbtQJ9gvuFoKaSTkCzBTI9pXpHn 7oqRRe1QcaFdwsDOB7CFbg4/mn+7XaQ8O01WBxAje0TBMDhGkTM692ZSgst9IT8+gbiVn n8IN3oFI+ZWG8VMaEiYhSDIXchIYJ/d6qRwM3UYjjYkGqx5RUD/ySzzHi3tV0n+L6hc25 gcBv6RU8Z0Wz62b78FmZ83XSM4IuCQPtP02faCPXF1ucM8825aEO2cVfslK/2cY+LCMww 9EOGVaafD6u2ZMhEHlrGFldOshQWCun1/PnMOV28c6eczgM86w/rTPhM9FagpgZzsWDvz D43+d58TEbalUDo66XAeupHmMBVUbSpM19Ub+bt9fO7HrBwNSE5BWCH2w9u3suk=
  • Arc-seal: i=1; d=bugseng.com; s=openarc; a=rsa-sha256; cv=none; t=1756194985; b=EElN+fFoy2R6YGEkxfGMlWldCMc7dMR5nG0jLAO4v39x9QuwE4TjCObbDwk0U3Pz6dUB hRgx3tlscoTYyh1wUIr9tH0Swbp7K2SWw6esqB5fGIZd6abqini+U53P6J5Mb+X5JrfiE B6qrPhU68aX8OpRTsj2J1yzfiivte0JoUQl1tntl1iLiYWIUv715oYfd2g5zYlec4cOy6 s4N3jzCkR160N983eu4C9LnCiBkjWLONmPqIvdpqzddH9NYk0YEiAQzMuRXH8me6E0yh0 TbmiEzeGzDu2l2KNgW5hxQASS/3u6uRNTec4Xe2mdOS7GIB3mTwvrNpVo/UCuDqYnuH3o E72GxtQso8IEdKG5929KZBoKDCdnvTP9AIo9s3/QrxsxfLV702ngPboQI0Ii99HO57UWl ODS4V9pIuqm6MuTFVNSngQNQ6v/3/dvNM1lA2fX8+adBSW+zrz+dit+9hQ/GCH6ajsrAC joK+RnjENDNzH4oUjdZWoiShdrahdhac3r2qwjPja3INszLoc97qpO+Dza+rTmS2+sX5i NgJF1g+HFnXx6iS8tMvEOQX3tIB2Sn8vJSjghopRzUx805An37ltR3DrvrbpGXrtKCxVv fEvyPgs72m/qXp5TkZwL2xmd7K75rv+uOntFfciYObBByh5+g0Ixhd8Wxg/0sps=
  • 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: Tue, 26 Aug 2025 07:56:32 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 2025-08-26 09:45, Jan Beulich wrote:
On 26.08.2025 09:36, Dmytro Prokopchuk1 wrote:
--- a/automation/eclair_analysis/ECLAIR/deviations.ecl
+++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
@@ -575,6 +575,11 @@ safe."
-config=MC3A2.R17.7,calls+={safe, "any()", "decl(name(__builtin_memcpy||__builtin_memmove||__builtin_memset||cpumask_check))"}
 -doc_end

+-doc_begin="It is safe to deviate functions like 'memcpy()', 'memset()', 'memmove()', as they return a value purely for convenience, +their primary functionality (memory manipulation) remains unaffected, and their return values are generally non-critical and seldom relied upon." +-config=MC3A2.R17.7,calls+={safe, "any()", "decl(name(memcpy||memset||memmove))"}
+-doc_end
+
 #
 # Series 18.
 #
--- a/docs/misra/deviations.rst
+++ b/docs/misra/deviations.rst
@@ -576,6 +576,13 @@ Deviations related to MISRA C:2012 Rules:
          - __builtin_memset()
          - cpumask_check()

+   * - R17.7
+ - It is safe to deviate functions like 'memcpy()', 'memset()', 'memmove()', + as they return a value purely for convenience, their primary functionality + (memory manipulation) remains unaffected, and their return values are
+       generally non-critical and seldom relied upon.
+     - Tagged as `safe` for ECLAIR.

I realize I may be overly nitpicky here, but in files named deviations.* I find it odd to read "It is safe to deviate ...". I further find the use of "like" odd when
you enumerate the complete set anyway.

I wonder whether the deviation wants generalizing anyway: Informational return values are generally okay to ignore. That is, the Eclair configuration would be limited to the three functions for now, but the text / comment could already be broader. Then, for example, open-coded uses of the corresponding builtin functions
would also be covered right away.


While I understand the pragmatic reasoning, from a MISRA compliance standpoint it would be better not to make the written justification and the actual deviation diverge, and then wide both the ECLAIR configuration and its justification suitably once new cases want to be deviated. Other than that,

Reviewed-by: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>

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