From nobody Thu May 9 22:20:14 2024 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1708436166128868.1354697770515; Tue, 20 Feb 2024 05:36:06 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.683532.1063093 (Exim 4.92) (envelope-from ) id 1rcQHW-00026s-9K; Tue, 20 Feb 2024 13:35:34 +0000 Received: by outflank-mailman (output) from mailman id 683532.1063093; Tue, 20 Feb 2024 13:35:34 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rcQHW-00026l-5m; Tue, 20 Feb 2024 13:35:34 +0000 Received: by outflank-mailman (input) for mailman id 683532; Tue, 20 Feb 2024 13:35:32 +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 1rcQHU-00026f-I1 for xen-devel@lists.xenproject.org; Tue, 20 Feb 2024 13:35:32 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id ea744172-cff4-11ee-8a52-1f161083a0e0; Tue, 20 Feb 2024 14:35:31 +0100 (CET) Received: from Dell.bugseng.com (unknown [37.163.67.214]) by support.bugseng.com (Postfix) with ESMTPSA id 78BC44EE073A; Tue, 20 Feb 2024 14:35:29 +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: ea744172-cff4-11ee-8a52-1f161083a0e0 From: Federico Serafini To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Federico Serafini , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu Subject: [XEN PATCH] x86/uaccess: add attribute noreturn to __{get,put}_user_bad() Date: Tue, 20 Feb 2024 14:35:20 +0100 Message-Id: <1595eac56587d20c7f86128bc5652c31c3a72772.1708436010.git.federico.serafini@bugseng.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1708436168745100001 Content-Type: text/plain; charset="utf-8" __get_user_bad() and __put_user_bad() are undefined symbols used to assert the unreachability of a program point: a call to one of such functions is optimized away if it is considered unreachable by the compiler. Otherwise, a linker error is reported. In accordance with the purpose of such constructs: 1) add the attribute noreturn to __get_user_bad() and __put_user_bad(); 2) change return type of __get_user_bad() to void (returning long is a leftover from the past). Point (1) meets the requirements to deviate MISRA C:2012 Rule 16.3 ("An unconditional break statement shall terminate every switch clause") since functions with noreturn attribute are considered as allowed terminals for switch clauses. Point (2) addresses several violations of MISRA C:2012 Rule 17.7 ("The value returned by a function having non-void return type shall be used"). No functional change. Signed-off-by: Federico Serafini Reviewed-by: Jan Beulich --- xen/arch/x86/include/asm/uaccess.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/include/asm/uaccess.h b/xen/arch/x86/include/asm/= uaccess.h index 7443519d5b..c7bafaf10f 100644 --- a/xen/arch/x86/include/asm/uaccess.h +++ b/xen/arch/x86/include/asm/uaccess.h @@ -21,8 +21,8 @@ unsigned int copy_from_guest_ll(void *to, const void __us= er *from, unsigned int unsigned int copy_to_unsafe_ll(void *to, const void *from, unsigned int n); unsigned int copy_from_unsafe_ll(void *to, const void *from, unsigned int = n); =20 -extern long __get_user_bad(void); -extern void __put_user_bad(void); +extern void noreturn __get_user_bad(void); +extern void noreturn __put_user_bad(void); =20 #define UA_KEEP(args...) args #define UA_DROP(args...) --=20 2.34.1