[PATCH 02/36] xsm/flask: missing breaks, MISRA rule 16.4

Denis Mukhin via B4 Relay posted 36 patches 11 months, 1 week ago
There is a newer version of this series
[PATCH 02/36] xsm/flask: missing breaks, MISRA rule 16.4
Posted by Denis Mukhin via B4 Relay 11 months, 1 week ago
From: Denis Mukhin <dmukhin@ford.com>

While working on console forwarding for virtual NS8250 I stepped into
  flask_domain_alloc_security()
where break statement was missing in default case which violates MISRA
rule 16.4.

Fixed everywhere in hooks.c.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
---
 xen/xsm/flask/hooks.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
index dfa23738cd8a9fd91eda23d9c328c3cc55d31418..a79474ffe43af19f602a6c067eab6b40dba0d946 100644
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -198,6 +198,7 @@ static int cf_check flask_domain_alloc_security(struct domain *d)
             else if ( pv_shim )
                 dsec->sid = SECINITSID_DOMU;
         }
+        break;
     }
 
     dsec->self_sid = dsec->sid;
@@ -342,6 +343,7 @@ static int cf_check flask_evtchn_send(struct domain *d, struct evtchn *chn)
         break;
     default:
         rc = avc_unknown_permission("event channel state", chn->state);
+        break;
     }
 
     return rc;
@@ -1310,6 +1312,7 @@ static int cf_check flask_hvm_param(struct domain *d, unsigned long op)
         break;
     default:
         perm = HVM__HVMCTL;
+        break;
     }
 
     return current_has_perm(d, SECCLASS_HVM, perm);
@@ -2013,6 +2016,7 @@ const struct xsm_ops *__init flask_init(
     case FLASK_BOOTPARAM_INVALID:
     default:
         panic("Flask: Invalid value for flask= boot parameter.\n");
+        break;
     }
 
     avc_init();

-- 
2.34.1
Re: [PATCH 02/36] xsm/flask: missing breaks, MISRA rule 16.4
Posted by Daniel P. Smith 11 months, 1 week ago
On 11/26/24 18:21, Denis Mukhin via B4 Relay wrote:
> From: Denis Mukhin <dmukhin@ford.com>
> 
> While working on console forwarding for virtual NS8250 I stepped into
>    flask_domain_alloc_security()
> where break statement was missing in default case which violates MISRA
> rule 16.4.
> 
> Fixed everywhere in hooks.c.
> 
> Signed-off-by: Denis Mukhin <dmukhin@ford.com>

Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>