[XEN PATCH v3] automation/eclair: add deviation for MISRA C Rule 17.7

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/b571bd05955ab9967a44517c9947545a2a530f01.1718354974.git.federico.serafini@bugseng.com
automation/eclair_analysis/ECLAIR/deviations.ecl | 4 ++++
docs/misra/deviations.rst                        | 9 +++++++++
2 files changed, 13 insertions(+)
[XEN PATCH v3] automation/eclair: add deviation for MISRA C Rule 17.7
Posted by Federico Serafini 5 months, 1 week ago
Update ECLAIR configuration to deviate some cases where not using
the return value of a function is not dangerous.

Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
---
Changes in v3:
- removed unwanted underscores;
- grammar fixed;
- do not constraint to the first actual argument.
Changes in v2:
- do not deviate strlcpy and strlcat.
---
 automation/eclair_analysis/ECLAIR/deviations.ecl | 4 ++++
 docs/misra/deviations.rst                        | 9 +++++++++
 2 files changed, 13 insertions(+)

diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/eclair_analysis/ECLAIR/deviations.ecl
index 447c1e6661..97281082a8 100644
--- a/automation/eclair_analysis/ECLAIR/deviations.ecl
+++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
@@ -413,6 +413,10 @@ explicit comment indicating the fallthrough intention is present."
 -config=MC3R1.R17.1,macros+={hide , "^va_(arg|start|copy|end)$"}
 -doc_end
 
+-doc_begin="Not using the return value of a function does not endanger safety if it coincides with an actual argument."
+-config=MC3R1.R17.7,calls+={safe, "any()", "decl(name(__builtin_memcpy||__builtin_memmove||__builtin_memset||cpumask_check))"}
+-doc_end
+
 #
 # Series 18.
 #
diff --git a/docs/misra/deviations.rst b/docs/misra/deviations.rst
index 36959aa44a..f3abe31eb5 100644
--- a/docs/misra/deviations.rst
+++ b/docs/misra/deviations.rst
@@ -364,6 +364,15 @@ Deviations related to MISRA C:2012 Rules:
        by `stdarg.h`.
      - Tagged as `deliberate` for ECLAIR.
 
+   * - R17.7
+     - Not using the return value of a function does not endanger safety if it
+       coincides with an actual argument.
+     - Tagged as `safe` for ECLAIR. Such functions are:
+         - __builtin_memcpy()
+         - __builtin_memmove()
+         - __builtin_memset()
+         - cpumask_check()
+
    * - R20.4
      - The override of the keyword \"inline\" in xen/compiler.h is present so
        that section contents checks pass when the compiler chooses not to
-- 
2.34.1
Re: [XEN PATCH v3] automation/eclair: add deviation for MISRA C Rule 17.7
Posted by Stefano Stabellini 5 months ago
On Fri, 14 Jun 2024, Federico Serafini wrote:
> Update ECLAIR configuration to deviate some cases where not using
> the return value of a function is not dangerous.
> 
> Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>

Acked-by: Stefano Stabellini <sstabellini@kernel.org>


> ---
> Changes in v3:
> - removed unwanted underscores;
> - grammar fixed;
> - do not constraint to the first actual argument.
> Changes in v2:
> - do not deviate strlcpy and strlcat.
> ---
>  automation/eclair_analysis/ECLAIR/deviations.ecl | 4 ++++
>  docs/misra/deviations.rst                        | 9 +++++++++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/eclair_analysis/ECLAIR/deviations.ecl
> index 447c1e6661..97281082a8 100644
> --- a/automation/eclair_analysis/ECLAIR/deviations.ecl
> +++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
> @@ -413,6 +413,10 @@ explicit comment indicating the fallthrough intention is present."
>  -config=MC3R1.R17.1,macros+={hide , "^va_(arg|start|copy|end)$"}
>  -doc_end
>  
> +-doc_begin="Not using the return value of a function does not endanger safety if it coincides with an actual argument."
> +-config=MC3R1.R17.7,calls+={safe, "any()", "decl(name(__builtin_memcpy||__builtin_memmove||__builtin_memset||cpumask_check))"}
> +-doc_end
> +
>  #
>  # Series 18.
>  #
> diff --git a/docs/misra/deviations.rst b/docs/misra/deviations.rst
> index 36959aa44a..f3abe31eb5 100644
> --- a/docs/misra/deviations.rst
> +++ b/docs/misra/deviations.rst
> @@ -364,6 +364,15 @@ Deviations related to MISRA C:2012 Rules:
>         by `stdarg.h`.
>       - Tagged as `deliberate` for ECLAIR.
>  
> +   * - R17.7
> +     - Not using the return value of a function does not endanger safety if it
> +       coincides with an actual argument.
> +     - Tagged as `safe` for ECLAIR. Such functions are:
> +         - __builtin_memcpy()
> +         - __builtin_memmove()
> +         - __builtin_memset()
> +         - cpumask_check()
> +
>     * - R20.4
>       - The override of the keyword \"inline\" in xen/compiler.h is present so
>         that section contents checks pass when the compiler chooses not to
> -- 
> 2.34.1
>
Re: [XEN PATCH v3] automation/eclair: add deviation for MISRA C Rule 17.7
Posted by Stefano Stabellini 5 months ago
On Wed, 19 Jun 2024, Stefano Stabellini wrote:
> On Fri, 14 Jun 2024, Federico Serafini wrote:
> > Update ECLAIR configuration to deviate some cases where not using
> > the return value of a function is not dangerous.
> > 
> > Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
> 
> Acked-by: Stefano Stabellini <sstabellini@kernel.org>
 
I would like to request a release ack, as this patch only affects the
ECLAIR analysis for R17.7, which is non-blocking anyway (meaning: it
cannot cause a gitlab-ci failure, it is only informative).



> > ---
> > Changes in v3:
> > - removed unwanted underscores;
> > - grammar fixed;
> > - do not constraint to the first actual argument.
> > Changes in v2:
> > - do not deviate strlcpy and strlcat.
> > ---
> >  automation/eclair_analysis/ECLAIR/deviations.ecl | 4 ++++
> >  docs/misra/deviations.rst                        | 9 +++++++++
> >  2 files changed, 13 insertions(+)
> > 
> > diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/eclair_analysis/ECLAIR/deviations.ecl
> > index 447c1e6661..97281082a8 100644
> > --- a/automation/eclair_analysis/ECLAIR/deviations.ecl
> > +++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
> > @@ -413,6 +413,10 @@ explicit comment indicating the fallthrough intention is present."
> >  -config=MC3R1.R17.1,macros+={hide , "^va_(arg|start|copy|end)$"}
> >  -doc_end
> >  
> > +-doc_begin="Not using the return value of a function does not endanger safety if it coincides with an actual argument."
> > +-config=MC3R1.R17.7,calls+={safe, "any()", "decl(name(__builtin_memcpy||__builtin_memmove||__builtin_memset||cpumask_check))"}
> > +-doc_end
> > +
> >  #
> >  # Series 18.
> >  #
> > diff --git a/docs/misra/deviations.rst b/docs/misra/deviations.rst
> > index 36959aa44a..f3abe31eb5 100644
> > --- a/docs/misra/deviations.rst
> > +++ b/docs/misra/deviations.rst
> > @@ -364,6 +364,15 @@ Deviations related to MISRA C:2012 Rules:
> >         by `stdarg.h`.
> >       - Tagged as `deliberate` for ECLAIR.
> >  
> > +   * - R17.7
> > +     - Not using the return value of a function does not endanger safety if it
> > +       coincides with an actual argument.
> > +     - Tagged as `safe` for ECLAIR. Such functions are:
> > +         - __builtin_memcpy()
> > +         - __builtin_memmove()
> > +         - __builtin_memset()
> > +         - cpumask_check()
> > +
> >     * - R20.4
> >       - The override of the keyword \"inline\" in xen/compiler.h is present so
> >         that section contents checks pass when the compiler chooses not to
> > -- 
> > 2.34.1
> > 
>
Re: [XEN PATCH v3] automation/eclair: add deviation for MISRA C Rule 17.7
Posted by Oleksii 5 months ago
On Fri, 2024-06-21 at 15:24 -0700, Stefano Stabellini wrote:
> On Wed, 19 Jun 2024, Stefano Stabellini wrote:
> > On Fri, 14 Jun 2024, Federico Serafini wrote:
> > > Update ECLAIR configuration to deviate some cases where not using
> > > the return value of a function is not dangerous.
> > > 
> > > Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
> > 
> > Acked-by: Stefano Stabellini <sstabellini@kernel.org>
>  
> I would like to request a release ack, as this patch only affects the
> ECLAIR analysis for R17.7, which is non-blocking anyway (meaning: it
> cannot cause a gitlab-ci failure, it is only informative).
Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>

~ Oleksii
> 
> 
> 
> > > ---
> > > Changes in v3:
> > > - removed unwanted underscores;
> > > - grammar fixed;
> > > - do not constraint to the first actual argument.
> > > Changes in v2:
> > > - do not deviate strlcpy and strlcat.
> > > ---
> > >  automation/eclair_analysis/ECLAIR/deviations.ecl | 4 ++++
> > >  docs/misra/deviations.rst                        | 9 +++++++++
> > >  2 files changed, 13 insertions(+)
> > > 
> > > diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl
> > > b/automation/eclair_analysis/ECLAIR/deviations.ecl
> > > index 447c1e6661..97281082a8 100644
> > > --- a/automation/eclair_analysis/ECLAIR/deviations.ecl
> > > +++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
> > > @@ -413,6 +413,10 @@ explicit comment indicating the fallthrough
> > > intention is present."
> > >  -config=MC3R1.R17.1,macros+={hide , "^va_(arg|start|copy|end)$"}
> > >  -doc_end
> > >  
> > > +-doc_begin="Not using the return value of a function does not
> > > endanger safety if it coincides with an actual argument."
> > > +-config=MC3R1.R17.7,calls+={safe, "any()",
> > > "decl(name(__builtin_memcpy||__builtin_memmove||__builtin_memset|
> > > |cpumask_check))"}
> > > +-doc_end
> > > +
> > >  #
> > >  # Series 18.
> > >  #
> > > diff --git a/docs/misra/deviations.rst
> > > b/docs/misra/deviations.rst
> > > index 36959aa44a..f3abe31eb5 100644
> > > --- a/docs/misra/deviations.rst
> > > +++ b/docs/misra/deviations.rst
> > > @@ -364,6 +364,15 @@ Deviations related to MISRA C:2012 Rules:
> > >         by `stdarg.h`.
> > >       - Tagged as `deliberate` for ECLAIR.
> > >  
> > > +   * - R17.7
> > > +     - Not using the return value of a function does not
> > > endanger safety if it
> > > +       coincides with an actual argument.
> > > +     - Tagged as `safe` for ECLAIR. Such functions are:
> > > +         - __builtin_memcpy()
> > > +         - __builtin_memmove()
> > > +         - __builtin_memset()
> > > +         - cpumask_check()
> > > +
> > >     * - R20.4
> > >       - The override of the keyword \"inline\" in xen/compiler.h
> > > is present so
> > >         that section contents checks pass when the compiler
> > > chooses not to
> > > -- 
> > > 2.34.1
> > > 
> >