From nobody Wed Feb 5 17:05:05 2025 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; dkim=pass; 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=pass(p=none dis=none) header.from=bugseng.com ARC-Seal: i=1; a=rsa-sha256; t=1733915006; cv=none; d=zohomail.com; s=zohoarc; b=RuHRRwo9Kp4Y1bpFSnlMxwI7wBbX+vJSnktrnCp5sn5PuxbTSjboNV7UypRIu5lqwuqkrOVBq+uMolEDh9Fg3+FjVJJRaul6xFej5CJVTtiN3uF4uwaBakfxg9Q2haIwHugIBtrzpxtgoGcGVdIcS9jmHNAWfWh5qZM1YdKmi3o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1733915006; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Xi2WRchvJE+t1pMfQMOyAXCn2a0eq5bQ8LIqOo/er9g=; b=Arpsp4BsqSlWCTAdraydCdNhj2SdAtwXRfY5lHia9RuGD4GjcoTHzmXrX7RVY4jYzFPUI22GFAjkLhG9czkKSolRJ7adlrHUG1Tut5RNVHKGPzcTADPkl0iRjd2fgfiLa74xZ6Hh9VYspiNymwL/i1Hcin/dSbNywm7N+xduMSQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1733915005999100.32288171047355; Wed, 11 Dec 2024 03:03:25 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.854557.1267734 (Exim 4.92) (envelope-from ) id 1tLKUm-0001Cx-S0; Wed, 11 Dec 2024 11:03:08 +0000 Received: by outflank-mailman (output) from mailman id 854557.1267734; Wed, 11 Dec 2024 11:03:08 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tLKUm-0001Cq-Nt; Wed, 11 Dec 2024 11:03:08 +0000 Received: by outflank-mailman (input) for mailman id 854557; Wed, 11 Dec 2024 11:03:06 +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 1tLKUk-0001Ch-2u for xen-devel@lists.xenproject.org; Wed, 11 Dec 2024 11:03:06 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 7ea22e79-b7af-11ef-a0d5-8be0dac302b0; Wed, 11 Dec 2024 12:03:04 +0100 (CET) Received: from delta.homenet.telecomitalia.it (host-82-59-161-229.retail.telecomitalia.it [82.59.161.229]) by support.bugseng.com (Postfix) with ESMTPSA id D00484EE073C; Wed, 11 Dec 2024 12:02:59 +0100 (CET) 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: 7ea22e79-b7af-11ef-a0d5-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bugseng.com; s=mail; t=1733914983; bh=7j8r/F7MsJqKq9M3+20mKheIJOo4WeDF5Oz3cppvmFY=; h=From:To:Cc:Subject:Date:From; b=MmFo/hmj1kDRxuieH8lygwwdU2o9F5jUxbmC7UBpna4hcjCWqmVy45b+g6dyJ+Kts 3yUT3L8dWYezNKzUEZCXfQ4o+3ovA6IaQu+HJxims/39+K+J5a4iFv30c5TspoPrw8 sdwqnPkKuJjlez12kMKwjacdtdCBqhjMQX2u7gHQiIa5WkS4NDH/XZp7bRKby+coBK eruqixTsuCV/gkHCcoMG5OcQGk1GorzClopYg8JQaZFjELg6r0MED8ggzDY/2k1D6r 1mPscwRz/frtAsS0phWnRGj2MQfdCrUaXTj//69VcYOGNC2cp20EPTp/hD1mwZw0YA mKQ4TGf03kFvg== From: Alessandro Zucchelli To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Alessandro Zucchelli , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH] xen: address violation of MISRA C Rule 11.1 Date: Wed, 11 Dec 2024 12:02:48 +0100 Message-ID: <7debd63f3900bad62bcbcc03081e4c04e6099135.1733914487.git.alessandro.zucchelli@bugseng.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @bugseng.com) X-ZM-MESSAGEID: 1733915012244116600 Content-Type: text/plain; charset="utf-8" Rule 11.1 states as following: "Conversions shall not be performed between a pointer to a function and any other type". Functions "__machine_restart" and "__machine_halt" in "x86/shutdown.c" and "halt_this_cpu" in "arm/shutdown.c" are defined as noreturn functions and subsequently passed as parameters to function calls. This violates the rule in Clang, where the "noreturn" attribute is considered part of the function"s type. By removing the "noreturn" attribbute and replacing it with uses of the ASSERT_UNREACHABLE macro, these violations are addressed. Signed-off-by: Alessandro Zucchelli --- xen/arch/arm/shutdown.c | 3 ++- xen/arch/x86/shutdown.c | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/xen/arch/arm/shutdown.c b/xen/arch/arm/shutdown.c index c9778e5786..e679ae8d72 100644 --- a/xen/arch/arm/shutdown.c +++ b/xen/arch/arm/shutdown.c @@ -8,7 +8,7 @@ #include #include =20 -static void noreturn halt_this_cpu(void *arg) +static void halt_this_cpu(void *arg) { local_irq_disable(); /* Make sure the write happens before we sleep forever */ @@ -38,6 +38,7 @@ void machine_halt(void) /* Alternative halt procedure */ platform_poweroff(); halt_this_cpu(NULL); + ASSERT_UNREACHABLE(); } =20 void machine_restart(unsigned int delay_millisecs) diff --git a/xen/arch/x86/shutdown.c b/xen/arch/x86/shutdown.c index 902076cf67..b684e19754 100644 --- a/xen/arch/x86/shutdown.c +++ b/xen/arch/x86/shutdown.c @@ -118,7 +118,7 @@ static inline void kb_wait(void) break; } =20 -static void noreturn cf_check __machine_halt(void *unused) +static void cf_check __machine_halt(void *unused) { local_irq_disable(); =20 @@ -127,6 +127,7 @@ static void noreturn cf_check __machine_halt(void *unus= ed) =20 for ( ; ; ) halt(); + ASSERT_UNREACHABLE(); } =20 void machine_halt(void) @@ -141,6 +142,7 @@ void machine_halt(void) } =20 __machine_halt(NULL); + ASSERT_UNREACHABLE(); } =20 static void default_reboot_type(void) @@ -520,9 +522,10 @@ static int __init cf_check reboot_init(void) } __initcall(reboot_init); =20 -static void cf_check noreturn __machine_restart(void *pdelay) +static void cf_check __machine_restart(void *pdelay) { machine_restart(*(unsigned int *)pdelay); + ASSERT_UNREACHABLE(); } =20 void machine_restart(unsigned int delay_millisecs) --=20 2.43.0