Skip to contentSkip to conversation

xen: address violations of MISRA C Rule 17.1

PATCH Superseded Simone Ballarin 2 participants 7 messages Mar 22, 2024

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#6 lore raw

PATCH v2 2/2 xen: address violations of MISRA C Rule 17.1

In reply to Simone Ballarin

MISRA C Rule 20.7 states: "The features of `<stdarg.h>' shall not be used"

The Xen community wants to avoid using variadic functions except for specific circumstances where it feels appropriate by strict code review.

Functions hypercall_create_continuation and hypercall_xlat_continuation are internal helper functions made to break long running hypercalls into multiple calls. They take a variable number of arguments depending on the original hypercall they are trying to continue.

Add SAF deviations for the aforementioned functions.

---
Changes in v2:
- replaced "special hypercalls" with "internal helper functions".

---
 docs/misra/safe.json     | 8 ++++++++
 xen/arch/arm/domain.c    | 1 +
 xen/arch/x86/hypercall.c | 2 ++
 3 files changed, 11 insertions(+)
docs/misra/safe.json +8 -0
index 952324f85c..1145967213 100644
@@ -28,6 +28,14 @@
         },
         {
             "id": "SAF-3-safe",
+            "analyser": {
+                "eclair": "MC3R1.R17.1"
+            },
+            "name": "Rule 17.1: internal helper functions made to break long running hypercalls into multiple calls.",
+            "text": "They need to take a variable number of arguments depending on the original hypercall they are trying to continue."
+        },
+        {
+            "id": "SAF-4-safe",
             "analyser": {},
             "name": "Sentinel",
             "text": "Next ID to be used"
xen/arch/arm/domain.c +1 -0
index 5e7a7f3e7e..f5706bd5b8 100644
@@ -382,6 +382,7 @@ unsigned long hypercall_create_continuation(
     const char *p = format;
     unsigned long arg, rc;
     unsigned int i;
+    /* SAF-3-safe allowed variadic function */
     va_list args;
 
     current->hcall_preempted = true;
xen/arch/x86/hypercall.c +2 -0
index 01cd73040d..18d8c75522 100644
@@ -31,6 +31,7 @@ unsigned long hypercall_create_continuation(
     const char *p = format;
     unsigned long arg;
     unsigned int i;
+    /* SAF-3-safe allowed variadic function */
     va_list args;
 
     curr->hcall_preempted = true;
@@ -115,6 +116,7 @@ int hypercall_xlat_continuation(unsigned int *id, unsigned int nr,
     struct cpu_user_regs *regs;
     unsigned int i, cval = 0;
     unsigned long nval = 0;
+    /* SAF-3-safe allowed variadic function */
     va_list args;
 
     ASSERT(nr <= ARRAY_SIZE(mcs->call.args));
Signature · 1 line
2.34.1
#0 lore raw

v2 cover xen: address violations of MISRA C Rule 17.1

MISRA C Rule 20.7 states: "The features of `<stdarg.h>' shall not be used".

The Xen community wants to avoid using variadic functions except for specific circumstances where it feels appropriate by strict code review.

Functions hypercall_create_continuation and hypercall_xlat_continuation are internal helpers made to break long running hypercalls into multiple calls. They take a variable number of arguments depending on the original hypercall they are trying to continue. Add SAF deviations for the aforementioned functions.

Add deviation for printf()-like functions.

---
Changes in v2:
- replace "related to console output" with "printf()-like functions";
- replace "special hypercalls" with "internal helpers".

Simone Ballarin (2):
automation/eclair: add deviation for MISRA C:2012 Rule 17.1
xen: address violations of MISRA C Rule 17.1

 .../eclair_analysis/ECLAIR/deviations.ecl     | 26 +++++++++++++++++++
 docs/misra/deviations.rst                     |  5 ++++
 docs/misra/safe.json                          |  8 ++++++
 xen/arch/arm/domain.c                         |  1 +
 xen/arch/x86/hypercall.c                      |  2 ++
 5 files changed, 42 insertions(+)
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 1/2 automation/eclair: add deviation for MISRA C:2012 Rule 17.1

MISRA C:2012 Rule 17.1 states:
The features of `<stdarg.h>' shall not be used

The Xen community wants to avoid using variadic functions except for specific circumstances where it feels appropriate by strict code review.

Add deviation for printf()-like functions.

---
Changes in v2:
- replace "console output related" with "printf()-like".

---
 .../eclair_analysis/ECLAIR/deviations.ecl     | 26 +++++++++++++++++++
 docs/misra/deviations.rst                     |  5 ++++
 2 files changed, 31 insertions(+)
automation/eclair_analysis/ECLAIR/deviations.ecl +26 -0
index 9ac3ee4dfd..334ee674c4 100644
@@ -382,6 +382,32 @@ explicit comment indicating the fallthrough intention is present."
 -config=MC3R1.R16.6,switch_clauses+={deliberate, "default(0)"}
 -doc_end
 
+#
+# Series 17.
+#
+
+-doc_begin="printf()-like functions are allowed to use the variadic features provided by stdarg.h."
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(debugtrace_printk)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(dt_dprintk)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(printk)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(guest_printk)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(panic)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(dprintk)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(gdprintk)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(snprintf)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(scnprintf)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(xasprintf)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(mm_printk)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(dbgp_printk)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(elf_call_log_callback)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(vsnprintf)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(vscnprintf)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(xvasprintf)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(vprintk_common)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(guest_printk)&&kind(function))))"}
+-config=MC3R1.R17.1,macros+={hide , "^va_(arg|start|copy|end)$"}
+-doc_end
+
 #
 # Series 18.
 #
docs/misra/deviations.rst +5 -0
index ce855ddae6..1e617f91f3 100644
@@ -328,6 +328,11 @@ Deviations related to MISRA C:2012 Rules:
        improve readability.
      - Tagged as `deliberate` for ECLAIR.
 
+   * - R17.1
+     - printf()-like functions  are allowed to use the variadic features provided
+       by `stdarg.h`.
+     - Tagged as `deliberate` for ECLAIR.
+
    * - R20.7
      - Code violating Rule 20.7 is safe when macro parameters are used:
        (1) as function arguments;
Signature · 1 line
2.34.1
#2 lore raw

Re: [XEN PATCH v2 1/2] automation/eclair: add deviation for MISRA C:2012 Rule 17.1

Quoted 21 lines · Simone Ballarin
automation/eclair_analysis/ECLAIR/deviations.ecl +15 -0
@@ -382,6 +382,32 @@ explicit comment indicating the fallthrough intention is present."
 -config=MC3R1.R16.6,switch_clauses+={deliberate, "default(0)"}
 -doc_end
 
+#
+# Series 17.
+#
+
+-doc_begin="printf()-like functions are allowed to use the variadic features provided by stdarg.h."
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(debugtrace_printk)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(dt_dprintk)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(printk)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(guest_printk)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(panic)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(dprintk)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(gdprintk)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(snprintf)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(scnprintf)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(xasprintf)&&kind(function))))"}

automation/eclair_analysis/ECLAIR/deviations.ecl explicit comment indicating the fallthrough intention is present." · line 409

Quoted 10 lines
automation/eclair_analysis/ECLAIR/deviations.ecl +10 -0
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(mm_printk)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(dbgp_printk)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(elf_call_log_callback)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(vsnprintf)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(vscnprintf)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(xvasprintf)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(vprintk_common)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(guest_printk)&&kind(function))))"}
+-config=MC3R1.R17.1,macros+={hide , "^va_(arg|start|copy|end)$"}
+-doc_end

Repeating v1 comments which weren't addressed:

Is there a reason xyzprintk() are all listed individually? Surely if we'd introduce a new flavor, we'd want that excluded too.

{,g}dprintk() in neither of their incarnation use any of the va_* items listed. Why do they need mentioning here?

Jan

#3 lore raw

Re: [XEN PATCH v2 1/2] automation/eclair: add deviation for MISRA C:2012 Rule 17.1

Quoted 35 lines · Jan Beulich
Quoted 21 lines · Simone Ballarin
automation/eclair_analysis/ECLAIR/deviations.ecl +15 -0
@@ -382,6 +382,32 @@ explicit comment indicating the fallthrough intention is present."
  -config=MC3R1.R16.6,switch_clauses+={deliberate, "default(0)"}
  -doc_end
 
+#
+# Series 17.
+#
+
+-doc_begin="printf()-like functions are allowed to use the variadic features provided by stdarg.h."
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(debugtrace_printk)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(dt_dprintk)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(printk)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(guest_printk)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(panic)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(dprintk)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(gdprintk)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(snprintf)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(scnprintf)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(xasprintf)&&kind(function))))"}

automation/eclair_analysis/ECLAIR/deviations.ecl explicit comment indicating the fallthrough intention is present." · line 409

Quoted 10 lines
automation/eclair_analysis/ECLAIR/deviations.ecl +10 -0
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(mm_printk)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(dbgp_printk)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(elf_call_log_callback)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(vsnprintf)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(vscnprintf)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(xvasprintf)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(vprintk_common)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(guest_printk)&&kind(function))))"}
+-config=MC3R1.R17.1,macros+={hide , "^va_(arg|start|copy|end)$"}
+-doc_end

Repeating v1 comments which weren't addressed> Is there a reason xyzprintk() are all listed individually? Surely if we'd introduce a new flavor, we'd want that excluded too.

Quoted 4 lines
Quoted 1 line

{,g}dprintk() in neither of their incarnation use any of the va_*

items listed. Why do they need mentioning here?

Jan

Sorry.

What do you mean with "xyzprintk()"? Maybe you mean a regex-based deviation using ".*printk\(.*\)"?
That would unnecessarily deviate "{,g}dprintk()" as you said.

Moreover, to cover also "vprintk_common", we would instead need something like "^.*printk.*\(.*\)$".

I'm fine in using "^.*printk.*\(.*\)$", I just preferred the individual whitelisting to avoid unwanted exclusions.

P.S:
using regex I cannot match only the name, but I have to match the entire signature.

Signature · 3 lines
Simone Ballarin, M.Sc.

Field Application Engineer, BUGSENG (https://bugseng.com)
#4 lore raw

Re: [XEN PATCH v2 1/2] automation/eclair: add deviation for MISRA C:2012 Rule 17.1

Quoted 37 lines · Simone Ballarin
Quoted 36 lines · Jan Beulich
Quoted 21 lines · Simone Ballarin
automation/eclair_analysis/ECLAIR/deviations.ecl +15 -0
@@ -382,6 +382,32 @@ explicit comment indicating the fallthrough intention is present."
  -config=MC3R1.R16.6,switch_clauses+={deliberate, "default(0)"}
  -doc_end
 
+#
+# Series 17.
+#
+
+-doc_begin="printf()-like functions are allowed to use the variadic features provided by stdarg.h."
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(debugtrace_printk)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(dt_dprintk)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(printk)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(guest_printk)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(panic)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(dprintk)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(gdprintk)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(snprintf)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(scnprintf)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(xasprintf)&&kind(function))))"}

automation/eclair_analysis/ECLAIR/deviations.ecl explicit comment indicating the fallthrough intention is present." · line 409

Quoted 10 lines
automation/eclair_analysis/ECLAIR/deviations.ecl +10 -0
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(mm_printk)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(dbgp_printk)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(elf_call_log_callback)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(vsnprintf)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(vscnprintf)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(xvasprintf)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(vprintk_common)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(guest_printk)&&kind(function))))"}
+-config=MC3R1.R17.1,macros+={hide , "^va_(arg|start|copy|end)$"}
+-doc_end

Repeating v1 comments which weren't addressed>
Is there a reason xyzprintk() are all listed individually? Surely if we'd introduce a new flavor, we'd want that excluded too.

Quoted 5 lines
Quoted 2 lines
Quoted 1 line

{,g}dprintk() in neither of their incarnation use any of the va_*

items listed. Why do they need mentioning here?

What do you mean with "xyzprintk()"? Maybe you mean a regex-based deviation using ".*printk\(.*\)"?

Regex or globbing, whatever is available.

Quoted 1 line

That would unnecessarily deviate "{,g}dprintk()" as you said.

Depends on how the regex would be written.

Quoted 2 lines

Moreover, to cover also "vprintk_common", we would instead need something like "^.*printk.*\(.*\)$".

Or simply accept that such outliers need listing individually. That would imo still be better than a dozen entries.

Quoted 6 lines

I'm fine in using "^.*printk.*\(.*\)$", I just preferred the individual whitelisting to avoid unwanted exclusions.

P.S:
using regex I cannot match only the name, but I have to match the entire signature.

Interesting. Is that a tool limitation?

Jan

#5 lore raw

Re: [XEN PATCH v2 1/2] automation/eclair: add deviation for MISRA C:2012 Rule 17.1

Quoted 48 lines · Jan Beulich
Quoted 37 lines · Simone Ballarin
Quoted 36 lines · Jan Beulich
Quoted 21 lines · Simone Ballarin
automation/eclair_analysis/ECLAIR/deviations.ecl +15 -0
@@ -382,6 +382,32 @@ explicit comment indicating the fallthrough intention is present."
   -config=MC3R1.R16.6,switch_clauses+={deliberate, "default(0)"}
   -doc_end
 
+#
+# Series 17.
+#
+
+-doc_begin="printf()-like functions are allowed to use the variadic features provided by stdarg.h."
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(debugtrace_printk)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(dt_dprintk)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(printk)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(guest_printk)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(panic)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(dprintk)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(gdprintk)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(snprintf)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(scnprintf)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(xasprintf)&&kind(function))))"}

automation/eclair_analysis/ECLAIR/deviations.ecl explicit comment indicating the fallthrough intention is present." · line 409

Quoted 10 lines
automation/eclair_analysis/ECLAIR/deviations.ecl +10 -0
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(mm_printk)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(dbgp_printk)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(elf_call_log_callback)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(vsnprintf)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(vscnprintf)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(xvasprintf)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(vprintk_common)&&kind(function))))"}
+-config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(guest_printk)&&kind(function))))"}
+-config=MC3R1.R17.1,macros+={hide , "^va_(arg|start|copy|end)$"}
+-doc_end

Repeating v1 comments which weren't addressed>
Is there a reason xyzprintk() are all listed individually? Surely if we'd introduce a new flavor, we'd want that excluded too.

Quoted 5 lines
Quoted 2 lines
Quoted 1 line

{,g}dprintk() in neither of their incarnation use any of the va_*

items listed. Why do they need mentioning here?

What do you mean with "xyzprintk()"? Maybe you mean a regex-based deviation using ".*printk\(.*\)"?

Regex or globbing, whatever is available.

Quoted 1 line

That would unnecessarily deviate "{,g}dprintk()" as you said.

Quoted 7 lines

Depends on how the regex would be written.

Quoted 2 lines

Moreover, to cover also "vprintk_common", we would instead need something like "^.*printk.*\(.*\)$".

Or simply accept that such outliers need listing individually. That would imo still be better than a dozen entries.

Ok, I will propose a patch using "^.*printk\(.*\)$"

Quoted 9 lines
Quoted 7 lines

I'm fine in using "^.*printk.*\(.*\)$", I just preferred the individual whitelisting to avoid unwanted exclusions.

P.S:
using regex I cannot match only the name, but I have to match the entire signature.

Interesting. Is that a tool limitation?

Why limitation? I wrote the P.S. just to motivate why I've added the "\(.*\)".

"name(abc)&&kind(function)" will simply become "^abc\(.*\)$".

Please note that I've removed "kind(function)" since the regex can only match functions.

Quoted 3 lines

Jan

Signature · 3 lines
Simone Ballarin, M.Sc.

Field Application Engineer, BUGSENG (https://bugseng.com)