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

[xen master] xen/domain: deviate MISRA C Rule 16.2 violation



commit 1fc166d6cd7a4b4b1ede9ffd2921d8b85cb93fdb
Author:     Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
AuthorDate: Mon Apr 22 15:11:38 2024 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon Apr 22 15:11:38 2024 +0200

    xen/domain: deviate MISRA C Rule 16.2 violation
    
    MISRA C Rule 16.2 states:
    "A switch label shall only be used when the most closely-enclosing
    compound statement is the body of a switch statement".
    
    The PROGRESS_VCPU local helper specifies a case that is directly
    inside the compound statement of a for loop, hence violating the rule.
    To avoid this, the construct is deviated with a text-based deviation.
    
    No functional change.
    
    Signed-off-by: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
    Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 docs/misra/safe.json | 8 ++++++++
 xen/common/domain.c  | 1 +
 2 files changed, 9 insertions(+)

diff --git a/docs/misra/safe.json b/docs/misra/safe.json
index fe2bc18509..9b13bcf717 100644
--- a/docs/misra/safe.json
+++ b/docs/misra/safe.json
@@ -44,6 +44,14 @@
         },
         {
             "id": "SAF-5-safe",
+            "analyser": {
+                "eclair": "MC3R1.R16.2"
+            },
+            "name": "MC3R1.R16.2: using a case label when the most 
closely-enclosing compound statement is not a switch statement",
+            "text": "A switch label enclosed by some compound statement that 
is not the body of a switch is permitted within local helper macros that are 
unlikely to be misused or misunderstood."
+        },
+        {
+            "id": "SAF-6-safe",
             "analyser": {},
             "name": "Sentinel",
             "text": "Next ID to be used"
diff --git a/xen/common/domain.c b/xen/common/domain.c
index 282c3ab623..6773f7fb90 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -457,6 +457,7 @@ static int domain_teardown(struct domain *d)
 
         for_each_vcpu ( d, v )
         {
+            /* SAF-5-safe MISRA C Rule 16.2: switch label enclosed by for loop 
*/
             PROGRESS_VCPU(teardown);
 
             rc = vcpu_teardown(v);
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

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