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

Re: [PATCH v2] misra: add deviations of MISRA C Rule 5.5


  • To: Dmytro Prokopchuk1 <dmytro_prokopchuk1@xxxxxxxx>
  • From: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
  • Date: Mon, 28 Jul 2025 12:38:17 +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=1753699097; 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=rErPABlR5sENyHp6yRUbAxEHAFAOK0uy8qiVrTwmf3Q=; b=jQeZ5sf6xJpKumM+SUZxRN5rm9GlOrIErtPVSThbz2T9Vx8ycfufSCQirRR4ghaUhSul qbl+Q+72spiQbjhVmPEZsBO7Eh0P0bePFXQr+j/amC+PGr97Uhggtky5iQeci2GO0D64n MiVGWd7xjIQFOmx6LdbDjEGVFWyktPan2uoxOdiln9sMkOerzePCqLMU4K0KyjyINOOd9 POPR5thothufxodwtEJzJbkNEIzeYSXR6bm6HzYSSA4K0WlDFPXUMHPPLHQxAXpStFJa/ kEcG33k0rApTkHvL6TrMFG1gmc1j5ekA1BokOTGXUp9CJiK2r8UECm5Qxj6EJiXUEVrrv BF9890IABvrxM0YTtRDwKhbkp0pCTGxSXTPA6Y70bh6x+0qALpAKmejvu86Xj7V8hUpko jcs2K9mZBIeSgnF5fTLz8qLioxwkdlNz3+lWkCSodMXnVCB0xwphvD8/p/BNnKJblQVII rGs4R6rpYuCdWlAnDigQa8Q7KSAGjOQfXbrBh0Ot6aPztYK81AzhkuOl4Il6I4fzeLun7 RIiE3lJbyDutP53RFPbjodvkNkqyHQC1kHhyuZDZ5UaC/3KoSuJkr+jGCmFcGLCUgkFJ9 R2bRZnVPx3ulNOCG0DZxjGsKGXtAOIy9XrY9SinSpYbZTYag4bYjyUuwqXmRCMc=
  • Arc-seal: i=1; d=bugseng.com; s=openarc; a=rsa-sha256; cv=none; t=1753699097; b=3oAG/jCaCAHnYZallGSz73OxDsA5Vm5rEEfekLssxRpHhW6IHEJTZvHyDajgzQfR6jPt ox5bJefQ7teIgEpS1YcaKvnTc9XT5i5yUIpInzgFAQB2pGY/PVleqvH5L/c+SMn0MS9dR gVdD08YJ3RyWwDvY+laczAU3Nl3zM2T5jBTzpIJYGrVxuGbMvTErfqflTNlF421jX4zyN bGYo1qft1/JOt0gaqXbXmCIh4XOOhXINV86A11rKPLA/ZTQ0KBfIN/uMNGFLVHBIO8n5/ TwsRPrMapUgYzAQTv8MStqkI7Go7cpimmePAnXIMah2FxkvrYjkSjcDpzkInyH9QHCgId TCwyPKePYJ9IeOtATX+oLz0EqWDNoNdvSZBWL7tsChSAvzCqzFHtBLwkgd6E8uY3FAoza 6M1lf7BYUzWIuzcPNQBvRZJ/8wP1YthJLmKa2Kh9ZHh15zbEf1zqi1tndGnJi9WcqeDW4 uocBZwEVW5aaeywQta7UGYu84kq+2dnXivMROSoMZV8C809VmfYir1RsfkVsWGowk5Uxy fEGKhloMNr/XR2akBGuMRVmbeL75DEiDCvxSDz3Waw87ZTZ+00Sld+obZ21XgOHurOsVq 3jbv/gJM/kYqQQ7XIdSlZjjK03yERMv3l27v6mGv7qIVL6bz4hD6wN7IyRsHMuA=
  • Authentication-results: bugseng.com; arc=none smtp.remote-ip=162.55.131.47
  • Cc: 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, Jbeulich <jbeulich@xxxxxxxx>
  • Delivery-date: Mon, 28 Jul 2025 10:38:23 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 2025-07-28 11:36, Jan Beulich wrote:
On 25.07.2025 18:24, Dmytro Prokopchuk1 wrote:
--- a/docs/misra/deviations.rst
+++ b/docs/misra/deviations.rst
@@ -142,6 +142,31 @@ Deviations related to MISRA C:2012 Rules:
        memmove.
      - Tagged as `deliberate` for ECLAIR.

+   * - R5.5
+ - Clashes between bitops functions and macros names are deliberate and are + needed for input validation and error handling, ensures that the size of + the object being pointed to by 'addr' meets the minimum requirements for + the bit operation, preventing unsafe operations on improperly sized data + types that could lead to undefined behavior or memory corruption. + The macros encapsulate this conditional logic into a single, reusable form;
+       which simplifies the code, avoids redundant function call.
+     - Specified macros should be ignored.

At the risk of going too far with nitpicking: Who are "specified macros" here? The text doesn't mention any names. In fact, the way it's written it could be taken to mean all macros there, including any that are yet to be added. I don't think such
is appropriate for a deviation.


I agree with Jan here. Either you make a single deviation record encompassing all deviated macros or you have one per deviation (e.g., one for irq.h, one for grant_table.h and one for bitops.h) listing the macros that are considered. For bitops it might be a concern the actual functions going out of sync, but in that case you could just spell out the deviation and say "all pairs functions/macros in file <file> that are defined using the same identifier" or something similar.

+   * - R5.5
+ - Clashes between 'pirq_cleanup_check' function and macro names are deliberate. + The purpose is to ensure that the specific cleanup action ('pirq_cleanup_check') + is performed conditionally when the parameter 'event channel number' equals
+       zero, otherwise it does nothing.
+ This approach simplifies the code, avoids redundant function call.
+     - Specified macro should be ignored.

Here it's clear which macro is meant, but ...

+   * - R5.5
+ - Clashes between grant table functions and macros names are deliberate. + These macros address differences in argument count during compile-time, + effectively discarding unused parameters to avoid warnings or errors
+       related to unused arguments.
+     - Specified macro should be ignored.

... here it again isn't.

Jan

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