From nobody Thu Sep 19 02:08:36 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 1719310502857344.93098850117644; Tue, 25 Jun 2024 03:15:02 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.747550.1155003 (Exim 4.92) (envelope-from ) id 1sM3CM-00084A-OI; Tue, 25 Jun 2024 10:14:50 +0000 Received: by outflank-mailman (output) from mailman id 747550.1155003; Tue, 25 Jun 2024 10:14:50 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sM3CM-000843-Lh; Tue, 25 Jun 2024 10:14:50 +0000 Received: by outflank-mailman (input) for mailman id 747550; Tue, 25 Jun 2024 10:14:49 +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 1sM3CL-0007WK-9l for xen-devel@lists.xenproject.org; Tue, 25 Jun 2024 10:14:49 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id c03fbf98-32db-11ef-b4bb-af5377834399; Tue, 25 Jun 2024 12:14:47 +0200 (CEST) Received: from delta.bugseng.com.homenet.telecomitalia.it (host-87-17-171-46.retail.telecomitalia.it [87.17.171.46]) by support.bugseng.com (Postfix) with ESMTPSA id F3BAD4EE0754; Tue, 25 Jun 2024 12:14:45 +0200 (CEST) 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: c03fbf98-32db-11ef-b4bb-af5377834399 From: Alessandro Zucchelli To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Alessandro Zucchelli , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini Subject: [PATCH 2/3] xen/event: address violation of MISRA C Rule 13.6 Date: Tue, 25 Jun 2024 12:14:20 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1719310505357100003 Content-Type: text/plain; charset="utf-8" In the file include/xen/event.h macro set_bit is called with argument current->pause_flags. Once expanded this set_bit's argument is used in sizeof operations and thus 'current', being a macro that expands to a function call with potential side effects, generates a violation. To address this violation the value of current is therefore stored in a variable called 'v' before passing it to macro set_bit. No functional change. Signed-off-by: Alessandro Zucchelli Reviewed-by: Stefano Stabellini --- xen/include/xen/event.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/xen/include/xen/event.h b/xen/include/xen/event.h index f1472ea1eb..48b79f3d62 100644 --- a/xen/include/xen/event.h +++ b/xen/include/xen/event.h @@ -183,13 +183,14 @@ static bool evtchn_usable(const struct evtchn *evtchn) /* Wait on a Xen-attached event channel. */ #define wait_on_xen_event_channel(port, condition) \ do { \ + struct vcpu *v =3D current; \ if ( condition ) \ break; \ - set_bit(_VPF_blocked_in_xen, ¤t->pause_flags); \ + set_bit(_VPF_blocked_in_xen, &v->pause_flags); \ smp_mb(); /* set blocked status /then/ re-evaluate condition */ \ if ( condition ) \ { \ - clear_bit(_VPF_blocked_in_xen, ¤t->pause_flags); \ + clear_bit(_VPF_blocked_in_xen, &v->pause_flags); \ break; \ } \ raise_softirq(SCHEDULE_SOFTIRQ); \ @@ -198,7 +199,8 @@ static bool evtchn_usable(const struct evtchn *evtchn) =20 #define prepare_wait_on_xen_event_channel(port) \ do { \ - set_bit(_VPF_blocked_in_xen, ¤t->pause_flags); \ + struct vcpu *v =3D current; \ + set_bit(_VPF_blocked_in_xen, &v->pause_flags); \ raise_softirq(SCHEDULE_SOFTIRQ); \ smp_mb(); /* set blocked status /then/ caller does his work */ \ } while ( 0 ) --=20 2.34.1