From patchwork Mon Oct 7 14:16:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Federico Serafini X-Patchwork-Id: 13824787 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 DFB99CFB441 for ; Mon, 7 Oct 2024 14:29:36 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.812105.1224820 (Exim 4.92) (envelope-from ) id 1sxojj-0004OG-Hj; Mon, 07 Oct 2024 14:29:23 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 812105.1224820; Mon, 07 Oct 2024 14:29:23 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sxojj-0004O9-Ej; Mon, 07 Oct 2024 14:29:23 +0000 Received: by outflank-mailman (input) for mailman id 812105; Mon, 07 Oct 2024 14:29:22 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sxoXM-0002dC-8D for xen-devel@lists.xenproject.org; Mon, 07 Oct 2024 14:16:36 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id c16f7f91-84b6-11ef-99a2-01e77a169b0f; Mon, 07 Oct 2024 16:16:33 +0200 (CEST) Received: from truciolo.bugseng.com (unknown [37.162.58.49]) by support.bugseng.com (Postfix) with ESMTPSA id ACA1E4EE0743; Mon, 7 Oct 2024 16:16:32 +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: c16f7f91-84b6-11ef-99a2-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bugseng.com; s=mail; t=1728310593; bh=pkehAqIigHugA14oiN/kSXZIjXGX6ygiIRmSA9aEPl0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DNsLZMClLCIOP+iP8GcTHaCg58dgwWfkO4r+WhG5ZXUvUN0XFBIc1ScaaIwfzRhfL /odxlPhj6dvIpEFtVIF20a88aIPFblEWcM9g0rkadhHOmkTB3USqkpTDp7NgUBeY98 MTLbB+0j3XluWB88FxHjz3xVp9fqLMQ6qyJPvbUu7PfiJqqityPafRMrZwu69ubTxE lIKwmy0JRR7Zzllp5I0yEmMUAevmpLiiC+TE4zq4Eu2Dx2CAwQheVCtNXeVZxWiLG0 152/2bXWyuG0avdiQDhlCSmOm7vhz6e0TVYB7cN0QiwA2KjZmGXLJRqaomAEafzt7V iRuv3ufAY364Q== From: Federico Serafini To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Federico Serafini , Jan Beulich , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Stefano Stabellini Subject: [XEN PATCH v2 1/4] x86/emul: add defensive code Date: Mon, 7 Oct 2024 16:16:16 +0200 Message-ID: <063bd71b535825715bd54ee9238bec2fc87f0bba.1728308312.git.federico.serafini@bugseng.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 Add defensive code after unreachable program points. This also meets the requirements to deviate violations of MISRA C:2012 Rule 16.3: "An unconditional `break' statement shall terminate every switch-clause". Signed-off-by: Federico Serafini --- Changes in v2: - use goto unhandleable. --- xen/arch/x86/x86_emulate/x86_emulate.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c index 0ea0d5e67e..6b6b8c8fe4 100644 --- a/xen/arch/x86/x86_emulate/x86_emulate.c +++ b/xen/arch/x86/x86_emulate/x86_emulate.c @@ -6840,6 +6840,7 @@ x86_emulate( break; default: ASSERT_UNREACHABLE(); + goto unhandleable; } break; #ifdef HAVE_AS_SSE4_2 @@ -6868,6 +6869,7 @@ x86_emulate( # endif default: ASSERT_UNREACHABLE(); + goto unhandleable; } break; #endif