[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[XEN PATCH 02/10] AMD/IOMMU: guest: address violations of MISRA C Rule 20.7



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@xxxxxxxxxxx>
---
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




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.