[XEN PATCH] automation/eclair: add deviations for MISRA C:2012 Rule 5.6

Federico Serafini posted 1 patch 5 months, 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/5826d25aeb31ebd29b0f2aebf3f78e676deb50b9.1701191295.git.federico.serafini@bugseng.com
There is a newer version of this series
automation/eclair_analysis/ECLAIR/deviations.ecl | 12 ++++++++++++
docs/misra/deviations.rst                        | 16 ++++++++++++++++
2 files changed, 28 insertions(+)
[XEN PATCH] automation/eclair: add deviations for MISRA C:2012 Rule 5.6
Posted by Federico Serafini 5 months, 1 week ago
Update ECLAIR configuration to take into account the adopted files
and type "ret_t".
Update docs/misra/deviations.rst accordingly.

Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
---
 automation/eclair_analysis/ECLAIR/deviations.ecl | 12 ++++++++++++
 docs/misra/deviations.rst                        | 16 ++++++++++++++++
 2 files changed, 28 insertions(+)

diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/eclair_analysis/ECLAIR/deviations.ecl
index c9e3a90801..3c6c7ce4a3 100644
--- a/automation/eclair_analysis/ECLAIR/deviations.ecl
+++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
@@ -81,6 +81,18 @@ conform to the directive."
 -config=MC3R1.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^read_debugreg$))&&any_exp(macro(^write_debugreg$))))"}
 -doc_end
 
+-doc_begin="The type \"ret_t\" is deliberately defined multiple times,
+depending on the guest."
+-config=MC3R1.R5.6,reports+={deliberate,"any_area(any_loc(text(^.*ret_t.*$)))"}
+-doc_end
+
+-doc_begin="The following files are imported from the gnu-efi package."
+-file_tag+={adopted_r5_6,"^xen/include/efi/.*$"}
+-file_tag+={adopted_r5_6,"^xen/arch/x86/include/asm/x86_64/efibind\\.h$"}
+-file_tag+={adopted_r5_6,"^xen/arch/arm/include/asm/arm64/efibind\\.h$"}
+-config=MC3R1.R5.6,reports+={deliberate,"any_area(any_loc(file(adopted_r5_6)))"}
+-doc_end
+
 #
 # Series 7.
 #
diff --git a/docs/misra/deviations.rst b/docs/misra/deviations.rst
index 160513b997..8cec2c556c 100644
--- a/docs/misra/deviations.rst
+++ b/docs/misra/deviations.rst
@@ -90,6 +90,22 @@ Deviations related to MISRA C:2012 Rules:
          - __emulate_2op and __emulate_2op_nobyte
          - read_debugreg and write_debugreg
 
+   * - R5.6
+     - The type ret_t is deliberately defined multiple times depending on the
+       type of guest to service.
+     - Tagged as `deliberate` for ECLAIR.
+
+   * - R5.6
+     - Some files are not subject to respect MISRA rules at
+       the moment, but, among these out-of-scope files, there are definitions
+       of typedef names that are already defined within in-scope files and
+       therefore, ECLAIR does report a violation since not all the files
+       involved in the violation are excluded from the analysis.
+     - Tagged as `deliberate` for ECLAIR. Such excluded files are:
+         - xen/include/efi/.*
+         - xen/arch/x86/include/asm/x86_64/efibind.h
+         - xen/arch/arm/include/asm/arm64/efibind.h
+
    * - R7.1
      - It is safe to use certain octal constants the way they are defined
        in specifications, manuals, and algorithm descriptions. Such places
-- 
2.34.1
Re: [XEN PATCH] automation/eclair: add deviations for MISRA C:2012 Rule 5.6
Posted by Jan Beulich 5 months, 1 week ago
On 28.11.2023 18:09, Federico Serafini wrote:
> --- a/docs/misra/deviations.rst
> +++ b/docs/misra/deviations.rst
> @@ -90,6 +90,22 @@ Deviations related to MISRA C:2012 Rules:
>           - __emulate_2op and __emulate_2op_nobyte
>           - read_debugreg and write_debugreg
>  
> +   * - R5.6
> +     - The type ret_t is deliberately defined multiple times depending on the
> +       type of guest to service.
> +     - Tagged as `deliberate` for ECLAIR.
> +
> +   * - R5.6
> +     - Some files are not subject to respect MISRA rules at
> +       the moment, but, among these out-of-scope files, there are definitions
> +       of typedef names that are already defined within in-scope files and
> +       therefore, ECLAIR does report a violation since not all the files
> +       involved in the violation are excluded from the analysis.
> +     - Tagged as `deliberate` for ECLAIR. Such excluded files are:
> +         - xen/include/efi/.*
> +         - xen/arch/x86/include/asm/x86_64/efibind.h
> +         - xen/arch/arm/include/asm/arm64/efibind.h

Could these two be generalized to xen/arch/*/include/asm/*/efibind.h?

Jan
Re: [XEN PATCH] automation/eclair: add deviations for MISRA C:2012 Rule 5.6
Posted by Federico Serafini 5 months ago
On 28/11/23 18:17, Jan Beulich wrote:
> On 28.11.2023 18:09, Federico Serafini wrote:
>> --- a/docs/misra/deviations.rst
>> +++ b/docs/misra/deviations.rst
>> @@ -90,6 +90,22 @@ Deviations related to MISRA C:2012 Rules:
>>            - __emulate_2op and __emulate_2op_nobyte
>>            - read_debugreg and write_debugreg
>>   
>> +   * - R5.6
>> +     - The type ret_t is deliberately defined multiple times depending on the
>> +       type of guest to service.
>> +     - Tagged as `deliberate` for ECLAIR.
>> +
>> +   * - R5.6
>> +     - Some files are not subject to respect MISRA rules at
>> +       the moment, but, among these out-of-scope files, there are definitions
>> +       of typedef names that are already defined within in-scope files and
>> +       therefore, ECLAIR does report a violation since not all the files
>> +       involved in the violation are excluded from the analysis.
>> +     - Tagged as `deliberate` for ECLAIR. Such excluded files are:
>> +         - xen/include/efi/.*
>> +         - xen/arch/x86/include/asm/x86_64/efibind.h
>> +         - xen/arch/arm/include/asm/arm64/efibind.h
> 
> Could these two be generalized to xen/arch/*/include/asm/*/efibind.h?

OK.

-- 
Federico Serafini, M.Sc.

Software Engineer, BUGSENG (http://bugseng.com)