|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [XEN PATCH v2 1/3] EFI: address a violation of MISRA C Rule 13.6
On 2024-10-02 08:09, Jan Beulich wrote: On 01.10.2024 23:36, Stefano Stabellini wrote:On Tue, 1 Oct 2024, Jan Beulich wrote:On 01.10.2024 07:25, Roberto Bagnara wrote:On 2024-09-30 15:07, Jan Beulich wrote:On 30.09.2024 14:49, Federico Serafini wrote:guest_handle_ok()'s expansion contains a sizeof() involving its first argument which is guest_handle_cast(). The expansion of the latter, in turn, contains a variable initialization. Since MISRA considers the initialization (even of a local variable) a side effect, the chain of expansions mentioned above violates MISRA C:2012 Rule 13.6 (The operand of the `sizeof' operator shall not contain any expression which has potential side effect).I'm afraid I need to ask for clarification of terminology and alike here. While the Misra doc has a section on Persistent Side Effects in its Glossary appendix, what constitutes a side effect from its pov isn't really spelled out anywhere. Which in turn raises the question whether it is indeed Misra (and not just Eclair) which deems initialization a side effect. This is even more so relevant as 13.6 talks of only expressions, yet initializers fall under declarations (in turn involving an expression on the rhs of the equal sign). All the same of course affects patch 2 then, too. You can do two things to obtain a second opinion: 1) Use the MISRA forum (here is the link to the forum section devoted to the side-effect rules of MISRA C:2012 and MISRA C:2023 (https://forum.misra.org.uk/forumdisplay.php?fid=168). The MISRA C Working Group will, in due course, provide you with an official answer to your questions about what, for the interpretation of Rule 13.6, has to be considered a side effect. 2) Reach out to your ISO National Body and try to obtain an official answer from ISO/IEC JTC1/SC22/WG14 (the international standardization working group for the programming language C) to your questions about what the C Standard considers to be side effects. Kind regards, Roberto Roberto Bagnara, Ph.D. Software Verification Expert and Evangelist, BUGSENG (http://bugseng.com) Professor of Computer Science, University of Parma Member, ISO/IEC JTC1/SC22/WG14 - C Standardization Working Group Member, MISRA C Working Group
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |