From nobody Tue Feb 10 03:38:55 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; 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1659703514; cv=none; d=zohomail.com; s=zohoarc; b=DVumSio8O4jhRgU68EiiuG6Ot8BW6Q32OskLv5Rl8P9UifIAtk3VWUY0GtKIGBldOgCi4b06gEP6lMLic4SBJ+m4jdCt2seaAVQesLP5JJiwB67OrPcr5nHd0PwfuOMuGLElIJd30e5KuZ2Y1nsBXoSoyo6cDGUyVycdcirugBQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1659703514; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=SDGt6RJ+ZB5pXGejCuARpIpNfU/+FrEqf6LGth7Ds0I=; b=lYDcaB6AoAuGLCXg19hjRQQLJhLW0kY/0mhMx5ZKeDW+nFdxyXhIxxfI18aIDncxMEKBBZIn3dfo3g0MPRf6AWkdEjb88xz4RYmKT4127yTn6BIhY9v9RGehtYwSnzmqDvOfRtHeAsnuPyRDCQn/FP096vB8lFz/ipsdqC21Qc0= 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 165970351446344.57347316883795; Fri, 5 Aug 2022 05:45:14 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.381156.615719 (Exim 4.92) (envelope-from ) id 1oJwhA-00059n-88; Fri, 05 Aug 2022 12:44:52 +0000 Received: by outflank-mailman (output) from mailman id 381156.615719; Fri, 05 Aug 2022 12:44:52 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oJwhA-00059d-4L; Fri, 05 Aug 2022 12:44:52 +0000 Received: by outflank-mailman (input) for mailman id 381156; Fri, 05 Aug 2022 12:44:50 +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 1oJwh7-0004jk-VN for xen-devel@lists.xenproject.org; Fri, 05 Aug 2022 12:44:50 +0000 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [2a00:1450:4864:20::329]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 64840cc9-14bc-11ed-bd2e-47488cf2e6aa; Fri, 05 Aug 2022 14:44:49 +0200 (CEST) Received: by mail-wm1-x329.google.com with SMTP id j4-20020a05600c1c0400b003a4f287418bso1228333wms.5 for ; Fri, 05 Aug 2022 05:44:49 -0700 (PDT) Received: from uni.. ([2a02:587:ac1d:6c00:cdd9:ab5d:6d5c:1538]) by smtp.googlemail.com with ESMTPSA id g11-20020a5d698b000000b0021eff2ecb31sm3993185wru.95.2022.08.05.05.44.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Aug 2022 05:44:48 -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: 64840cc9-14bc-11ed-bd2e-47488cf2e6aa DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=SDGt6RJ+ZB5pXGejCuARpIpNfU/+FrEqf6LGth7Ds0I=; b=adpcAg1igBCUfHUwrjCwgQ4nk6jPzMyEPxErkQ66X5lexek8Rdn0EFnsEUKK3VEJL6 SOP71pHwaBwMka2blqPfZHAfwR2SMnW3LuJA0w2sSuYb+kCyfczyVAvyBe8EfuY03fG5 oEOAKPVwuRip8+l5kRrVb335RPoEdjNfzqXVU92E7vXnN9dJHApK2JNc3N26+yJVGQB0 XqNqIqIx5+KPvO8Yx821SxZt7bbyJa2y++Lrh1hNCFq/GzK3feDywGsY6w+crRl1hMCX 6GWBx4NB6VZazYH+StlbRRCyerh3H3DK7ESv+pSE0J/kcdYAl7HPdtFz6WxJD9Vr8uii uyYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=SDGt6RJ+ZB5pXGejCuARpIpNfU/+FrEqf6LGth7Ds0I=; b=WnfLeoYe7MjcU8hhbBKP66dSK03Sbtnezr0gx+RJOA1D5JSGWxiAz9V2eYxFSfUehU evYdpAlsO9TVkby5F4ceRnNJedE7SiNpSDpRXZMFxJk8fQdM3erDRNMAqIJaWprwXGn0 n8ux6wE3NhqqJIHomRgaJ0tNbzlzISjJrt8TvZGyGaP17uvJZ4hUL9L4EX9A4YaVxIy0 wpzbVQ4lZtzguNmxLVnORmgfjdPSYnfhFiTPpxWyYsEYslVu20eQyRI4emzBafkGplle MJMYHHxzmOfrsN/PZxORHI16QehvIN8jVUBp4O6WHLgDi1f4+xboWNqqXkofPCZ4Bv3c tPPg== X-Gm-Message-State: ACgBeo2hXIuCMXjuc4cfROg2nyF2UuT29eLsKeoxZiR3uUP3BtpM75d8 TqGrlUqmn6pUfRbeof1OIwI7YUk8Yrk= X-Google-Smtp-Source: AA6agR55ntopDM59sXTkYdsI3FM/121Wo2KC1XRYR50IhyYiTtwTYDm3Pp++I/uF5Fo8S2I9gINSMA== X-Received: by 2002:a05:600c:2d02:b0:3a5:e61:d876 with SMTP id x2-20020a05600c2d0200b003a50e61d876mr4578664wmf.132.1659703488663; Fri, 05 Aug 2022 05:44:48 -0700 (PDT) From: Xenia Ragiadakou To: xen-devel@lists.xenproject.org Cc: Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu Subject: [PATCH v2 1/3] xen/cpu: Fix MISRA C 2012 Rule 20.7 violation Date: Fri, 5 Aug 2022 15:44:40 +0300 Message-Id: <20220805124442.1857692-2-burzalodowa@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220805124442.1857692-1-burzalodowa@gmail.com> References: <20220805124442.1857692-1-burzalodowa@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1659703515420100001 Content-Type: text/plain; charset="utf-8" In MASK_DECLARE_ macros, the macro parameter 'x' is used as expression and therefore it is good to be enclosed in parentheses to prevent against unintended expansions. Signed-off-by: Xenia Ragiadakou --- Changes in v2: - fix MISRA C 2012 Rule 20.7 violation in all MASK_DECLARE_ macros xen/common/cpu.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xen/common/cpu.c b/xen/common/cpu.c index b0b63cdb36..feb2a6634e 100644 --- a/xen/common/cpu.c +++ b/xen/common/cpu.c @@ -25,10 +25,10 @@ const cpumask_t cpumask_all =3D { */ =20 /* cpu_bit_bitmap[0] is empty - so we can back into it */ -#define MASK_DECLARE_1(x) [x+1][0] =3D 1UL << (x) -#define MASK_DECLARE_2(x) MASK_DECLARE_1(x), MASK_DECLARE_1(x+1) -#define MASK_DECLARE_4(x) MASK_DECLARE_2(x), MASK_DECLARE_2(x+2) -#define MASK_DECLARE_8(x) MASK_DECLARE_4(x), MASK_DECLARE_4(x+4) +#define MASK_DECLARE_1(x) [(x)+1][0] =3D 1UL << (x) +#define MASK_DECLARE_2(x) MASK_DECLARE_1(x), MASK_DECLARE_1((x)+1) +#define MASK_DECLARE_4(x) MASK_DECLARE_2(x), MASK_DECLARE_2((x)+2) +#define MASK_DECLARE_8(x) MASK_DECLARE_4(x), MASK_DECLARE_4((x)+4) =20 const unsigned long cpu_bit_bitmap[BITS_PER_LONG+1][BITS_TO_LONGS(NR_CPUS)= ] =3D { =20 --=20 2.34.1