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

Re: struct mctelem_cookie missing definition



On Fri, 14 Feb 2025, Jan Beulich wrote:
> > Would deviating macros "COOKIE2MCTE" and "MCTE2COOKIE" work?
> 
> If it did, COOKIE2ID and ID2COOKIE would likely need including as well.

I wrote this patch. Nicola, can you please check the changes to
deviations.ecl, this is the first time I try to write the deviation
myself :-)

---
misra: add 11.2 deviation for incomplete types

struct mctelem_cookie* is used exactly because it is an incomplete type
so the pointer cannot be dereferenced. This is deliberate. So add a
deviation for it.

In deviations.ecl, add the list of macros that do the conversions to and
from struct mctelem_cookie*.

Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxx>

diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl 
b/automation/eclair_analysis/ECLAIR/deviations.ecl
index a28eb0ae76..87bfd2160c 100644
--- a/automation/eclair_analysis/ECLAIR/deviations.ecl
+++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
@@ -366,6 +366,14 @@ constant expressions are required.\""
 }
 -doc_end
 
+-doc_begin="Certain pointers point to incomplete types purposely so that they 
are impossible to dereference."
+-config=MC3A2.R11.2,reports+={deliberate, 
"any_area(any_loc(any_exp(macro(^COOKIE2MCTE$))))"}
+-config=MC3A2.R11.2,reports+={deliberate, 
"any_area(any_loc(any_exp(macro(^MCTE2COOKIE$))))"}
+-config=MC3A2.R11.2,reports+={deliberate, 
"any_area(any_loc(any_exp(macro(^COOKIE2ID$))))"}
+-config=MC3A2.R11.2,reports+={deliberate, 
"any_area(any_loc(any_exp(macro(^ID2COOKIE$))))"}
+}
+-doc_end
+
 -doc_begin="Conversions to object pointers that have a pointee type with a 
smaller (i.e., less strict) alignment requirement are safe."
 -config=MC3A2.R11.3,casts+={safe,
   "!relation(more_aligned_pointee)"
diff --git a/docs/misra/deviations.rst b/docs/misra/deviations.rst
index fe0b1e10a2..f3004d6023 100644
--- a/docs/misra/deviations.rst
+++ b/docs/misra/deviations.rst
@@ -324,6 +324,12 @@ Deviations related to MISRA C:2012 Rules:
        semantics that do not lead to unexpected behaviour.
      - Tagged as `safe` for ECLAIR.
 
+   * - R11.2
+     - Certain pointers point to incomplete types purposely so that they
+       are impossible to dereference.
+     - Tagged as `deliberate` for ECLAIR. Such pointer is struct
+       mctelem_cookie \*.
+
    * - R11.2
      - The conversion from a pointer to an incomplete type to unsigned long
        does not lose any information, provided that the target type has enough



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.