All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicola Vetrini <nicola.vetrini@bugseng.com>
To: nicola.vetrini@bugseng.com, xen-devel@lists.xenproject.org
Cc: sstabellini@kernel.org, michal.orzel@amd.com,
	xenia.ragiadakou@amd.com, ayan.kumar.halder@amd.com,
	consulting@bugseng.com, Jan Beulich <jbeulich@suse.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>
Subject: [XEN PATCH 02/10] AMD/IOMMU: guest: address violations of MISRA C Rule 20.7
Date: Mon, 18 Mar 2024 12:53:45 +0100	[thread overview]
Message-ID: <b207f43e618d19292aa95809d13fbf86cf5ba2a8.1710762555.git.nicola.vetrini@bugseng.com> (raw)
In-Reply-To: <cover.1710762555.git.nicola.vetrini@bugseng.com>

MISRA C Rule 20.7 states: "Expressions resulting from the expansion
of macro parameters shall be enclosed in parentheses". Therefore, some
macro definitions should gain additional parentheses to ensure that all
current and future users will be safe with respect to expansions that
can possibly alter the semantics of the passed-in macro parameter.

No functional change.

Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
---
This local helper may disappear as a follow-up to [1], if the function that
remains there after the cleanup ends up being removed, so this patch has a slight
dependency on what follows up from that thread (in which case it can be dropped).

[1] https://lore.kernel.org/xen-devel/alpine.DEB.2.22.394.2403151724380.853156@ubuntu-linux-20-04-desktop/T/#m9474ad4f35830345a22acd4a665245f7085d4b46
---
 xen/drivers/passthrough/amd/iommu_guest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/amd/iommu_guest.c b/xen/drivers/passthrough/amd/iommu_guest.c
index 4c4252eea116..5bfaa48d9d65 100644
--- a/xen/drivers/passthrough/amd/iommu_guest.c
+++ b/xen/drivers/passthrough/amd/iommu_guest.c
@@ -30,7 +30,7 @@
 #define GUEST_ADDRESS_SIZE_6_LEVEL              0x2
 #define HOST_ADDRESS_SIZE_6_LEVEL               0x2
 
-#define reg_to_u64(reg) (((uint64_t)reg.hi << 32) | reg.lo )
+#define reg_to_u64(reg) (((uint64_t)((reg).hi << 32)) | (reg).lo )
 #define u64_to_reg(reg, val) \
     do \
     { \
-- 
2.34.1



  parent reply	other threads:[~2024-03-18 11:54 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-18 11:53 [XEN PATCH 00/10] address some violations of MISRA C Rule 20.7 Nicola Vetrini
2024-03-18 11:53 ` [XEN PATCH 01/10] x86/cpufeature: add parentheses to comply with " Nicola Vetrini
2024-03-18 16:42   ` Jan Beulich
2024-03-18 11:53 ` Nicola Vetrini [this message]
2024-03-18 16:43   ` [XEN PATCH 02/10] AMD/IOMMU: guest: address violations of MISRA C " Jan Beulich
2024-03-18 11:53 ` [XEN PATCH 03/10] xen/xsm: add parentheses to comply with " Nicola Vetrini
2024-03-19  3:32   ` Stefano Stabellini
2024-03-18 11:53 ` [XEN PATCH 04/10] xen/device_tree: address violations of " Nicola Vetrini
2024-03-19  3:33   ` Stefano Stabellini
2024-03-18 11:53 ` [XEN PATCH 05/10] EFI: " Nicola Vetrini
2024-03-18 16:47   ` Jan Beulich
2024-03-18 11:53 ` [XEN PATCH 06/10] xen/arm: smmu: " Nicola Vetrini
2024-03-19  3:32   ` Stefano Stabellini
2024-03-18 11:53 ` [XEN PATCH 07/10] xen/efi: efibind: " Nicola Vetrini
2024-03-18 16:49   ` Jan Beulich
2024-03-18 17:03     ` Nicola Vetrini
2024-03-18 11:53 ` [XEN PATCH 08/10] xen/notifier: " Nicola Vetrini
2024-03-18 16:50   ` Jan Beulich
2024-03-18 11:53 ` [XEN PATCH 09/10] xen/wait: " Nicola Vetrini
2024-03-18 16:51   ` Jan Beulich
2024-03-18 11:53 ` [XEN PATCH 10/10] xen/sched: " Nicola Vetrini
2024-03-18 12:00   ` George Dunlap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b207f43e618d19292aa95809d13fbf86cf5ba2a8.1710762555.git.nicola.vetrini@bugseng.com \
    --to=nicola.vetrini@bugseng.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ayan.kumar.halder@amd.com \
    --cc=consulting@bugseng.com \
    --cc=jbeulich@suse.com \
    --cc=michal.orzel@amd.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    --cc=xenia.ragiadakou@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.