From nobody Mon Mar 23 21:25:53 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=arm.com Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 17739976848978.778601547896073; Fri, 20 Mar 2026 02:08:04 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1257870.1552133 (Exim 4.92) (envelope-from ) id 1w3Vpb-0006RA-Sh; Fri, 20 Mar 2026 09:07:47 +0000 Received: by outflank-mailman (output) from mailman id 1257870.1552133; Fri, 20 Mar 2026 09:07:47 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1w3Vpb-0006R1-PR; Fri, 20 Mar 2026 09:07:47 +0000 Received: by outflank-mailman (input) for mailman id 1257870; Fri, 20 Mar 2026 09:07:46 +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 1w3Vpa-0006Cy-QT for xen-devel@lists.xenproject.org; Fri, 20 Mar 2026 09:07:46 +0000 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by se1-gles-sth1.inumbo.com (Halon) with ESMTP id 425ef13e-243c-11f1-b164-2bf370ae4941; Fri, 20 Mar 2026 10:07:45 +0100 (CET) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 018D21682; Fri, 20 Mar 2026 02:07:39 -0700 (PDT) Received: from C3HXLD123V.arm.com (unknown [10.57.84.63]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B34583F778; Fri, 20 Mar 2026 02:07:43 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 425ef13e-243c-11f1-b164-2bf370ae4941 From: Bertrand Marquis To: xen-devel@lists.xenproject.org Cc: Volodymyr Babchuk , Jens Wiklander , Stefano Stabellini , Julien Grall , Michal Orzel Subject: [PATCH 2/2] xen/arm: optee: Add MISRA-compliant switch default labels Date: Fri, 20 Mar 2026 10:07:22 +0100 Message-ID: <0050ab559814a619b4ae23dd070e7aa4629865e2.1773911799.git.bertrand.marquis@arm.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1773997686052154100 Content-Type: text/plain; charset="utf-8" optee.c has several switch statements over integer-valued OP-TEE fields without a default label, and two default clauses that only contain break. This triggers MISRA C Rule 16.4 findings. Add explicit default labels to all reported switches and document the intentional no-op defaults with rationale comments. The new default paths preserve the existing behavior: - unsupported parameter attribute types are ignored; - non-handled RPC commands require no post-processing in Xen; - unknown RPC function IDs are resumed unchanged. No functional changes. Signed-off-by: Bertrand Marquis Reviewed-by: Jens Wiklander Reviewed-by: Michal Orzel --- xen/arch/arm/tee/optee.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/xen/arch/arm/tee/optee.c b/xen/arch/arm/tee/optee.c index f719d9d767ab..3d2633237074 100644 --- a/xen/arch/arm/tee/optee.c +++ b/xen/arch/arm/tee/optee.c @@ -897,6 +897,9 @@ static int translate_params(struct optee_domain *ctx, case OPTEE_MSG_ATTR_TYPE_RMEM_OUTPUT: case OPTEE_MSG_ATTR_TYPE_RMEM_INOUT: continue; + default: + /* Ignore unsupported parameter type. */ + continue; } } =20 @@ -1027,6 +1030,9 @@ static void copy_std_request_back(struct optee_domain= *ctx, case OPTEE_MSG_ATTR_TYPE_RMEM_INPUT: case OPTEE_MSG_ATTR_TYPE_TMEM_INPUT: continue; + default: + /* No output fields to copy for unsupported parameter type. */ + continue; } } =20 @@ -1050,6 +1056,7 @@ static void free_shm_buffers(struct optee_domain *ctx, free_optee_shm_buf(ctx, arg->params[i].u.tmem.shm_ref); break; default: + /* No temporary SHM buffer to free for other parameter types. = */ break; } } @@ -1503,6 +1510,7 @@ static void handle_rpc_cmd(struct optee_domain *ctx, = struct cpu_user_regs *regs, case OPTEE_RPC_CMD_SHM_FREE: break; default: + /* Other RPC commands need no Xen-side post-processing here. */ break; } } @@ -1591,6 +1599,9 @@ static void handle_rpc(struct optee_domain *ctx, stru= ct cpu_user_regs *regs) case OPTEE_SMC_RPC_FUNC_CMD: handle_rpc_cmd(ctx, regs, call); return; + default: + /* Resume the call unchanged for unknown RPC function IDs. */ + break; } =20 do_call_with_arg(ctx, call, regs, OPTEE_SMC_CALL_RETURN_FROM_RPC, --=20 2.52.0