From patchwork Fri Apr 5 09:14:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicola Vetrini X-Patchwork-Id: 13618755 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AEE52CD12A0 for ; Fri, 5 Apr 2024 09:14:59 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.701166.1095406 (Exim 4.92) (envelope-from ) id 1rsfet-0000V4-TP; Fri, 05 Apr 2024 09:14:51 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 701166.1095406; Fri, 05 Apr 2024 09:14:51 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rsfet-0000SK-Gg; Fri, 05 Apr 2024 09:14:51 +0000 Received: by outflank-mailman (input) for mailman id 701166; Fri, 05 Apr 2024 09:14:50 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rsfer-0007cm-T5 for xen-devel@lists.xenproject.org; Fri, 05 Apr 2024 09:14:49 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id f3dbb950-f32c-11ee-afe6-a90da7624cb6; Fri, 05 Apr 2024 11:14:49 +0200 (CEST) Received: from nico.bugseng.com (unknown [46.228.253.194]) by support.bugseng.com (Postfix) with ESMTPSA id 5D1974EE074B; Fri, 5 Apr 2024 11:14:48 +0200 (CEST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: f3dbb950-f32c-11ee-afe6-a90da7624cb6 From: Nicola Vetrini To: nicola.vetrini@bugseng.com, xen-devel@lists.xenproject.org Cc: sstabellini@kernel.org, michal.orzel@amd.com, xenia.ragiadakou@amd.com, ayan.kumar.halder@amd.com, consulting@bugseng.com, Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall Subject: [XEN PATCH v2 8/9] xen/domain: deviate MISRA C Rule 16.2 violation Date: Fri, 5 Apr 2024 11:14:36 +0200 Message-Id: <2328b1a43f8bc4c9a9303c46f8eba2847c67a713.1712305581.git.nicola.vetrini@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 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 Acked-by: Jan Beulich --- I chose a text-based deviation, rather than exempting PROGRESS_VCPU, because it's more refined and it's unlikely that more violations are introduced, since the rule has only very few violations left on both ARM and x86. --- 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 d361d0e65ceb..64178ba2ef7d 100644 --- a/docs/misra/safe.json +++ b/docs/misra/safe.json @@ -36,6 +36,14 @@ }, { "id": "SAF-4-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-5-safe", "analyser": {}, "name": "Sentinel", "text": "Next ID to be used" diff --git a/xen/common/domain.c b/xen/common/domain.c index ceb44c826685..1388b9e7cefa 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-4-safe MISRA C Rule 16.2: switch label enclosed by for loop*/ PROGRESS_VCPU(teardown); rc = vcpu_teardown(v);