From: Nicola Vetrini <nicola.vetrini@bugseng.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Xen-devel <xen-devel@lists.xenproject.org>,
"Jan Beulich" <JBeulich@suse.com>,
"Roger Pau Monné" <roger.pau@citrix.com>,
"Stefano Stabellini" <sstabellini@kernel.org>,
"Julien Grall" <julien@xen.org>,
"Volodymyr Babchuk" <Volodymyr_Babchuk@epam.com>,
"Bertrand Marquis" <bertrand.marquis@arm.com>,
"Michal Orzel" <michal.orzel@amd.com>,
"consulting @ bugseng . com" <consulting@bugseng.com>
Subject: Re: [PATCH 11/12] xen: Bracket uses of macro parameters
Date: Fri, 20 Feb 2026 23:45:18 +0100 [thread overview]
Message-ID: <a917dc27a7fba87a8f829558444545bb@bugseng.com> (raw)
In-Reply-To: <20260220214653.3497384-12-andrew.cooper3@citrix.com>
On 2026-02-20 22:46, Andrew Cooper wrote:
> Fixing Rule 20.7 violations.
>
> No functional change.
>
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
Two minor nits below
> ---
> CC: Jan Beulich <JBeulich@suse.com>
> CC: Roger Pau Monné <roger.pau@citrix.com>
> CC: Stefano Stabellini <sstabellini@kernel.org>
> CC: Julien Grall <julien@xen.org>
> CC: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
> CC: Bertrand Marquis <bertrand.marquis@arm.com>
> CC: Michal Orzel <michal.orzel@amd.com>
> CC: consulting@bugseng.com <consulting@bugseng.com>
> CC: Nicola Vetrini <nicola.vetrini@bugseng.com>
> ---
> xen/arch/arm/pci/pci-access.c | 6 +++---
> xen/arch/x86/include/asm/bootinfo.h | 2 +-
> xen/arch/x86/mm/shadow/multi.c | 2 +-
> xen/common/kimage.c | 11 ++++++-----
> xen/common/livepatch.c | 11 ++++++-----
> xen/crypto/vmac.c | 8 ++++----
> xen/include/xen/libfdt/libfdt.h | 6 +++---
> 7 files changed, 24 insertions(+), 22 deletions(-)
>
> diff --git a/xen/arch/arm/pci/pci-access.c
> b/xen/arch/arm/pci/pci-access.c
> index 2b23d552bbfb..7bd6877596d4 100644
> --- a/xen/arch/arm/pci/pci-access.c
> +++ b/xen/arch/arm/pci/pci-access.c
> @@ -16,7 +16,7 @@
> #include <asm/io.h>
>
> #define INVALID_VALUE (~0U)
> -#define PCI_ERR_VALUE(len) GENMASK(0, len * 8)
> +#define PCI_ERR_VALUE(len) GENMASK(0, (len) * 8)
>
> static const struct pci_ops *get_ops(struct pci_host_bridge *bridge,
> pci_sbdf_t sbdf)
> @@ -139,14 +139,14 @@ static void pci_config_write(pci_sbdf_t sbdf,
> unsigned int reg,
> void pci_conf_write##size(pci_sbdf_t sbdf, \
> unsigned int reg, type data) \
> { \
> - pci_config_write(sbdf, reg, size / 8, data); \
> + pci_config_write(sbdf, reg, (size) / 8, data); \
> }
>
> #define PCI_OP_READ(size, type) \
> type pci_conf_read##size(pci_sbdf_t sbdf, \
> unsigned int reg) \
> { \
> - return pci_config_read(sbdf, reg, size / 8); \
> + return pci_config_read(sbdf, reg, (size) / 8); \
> }
>
> PCI_OP_READ(8, uint8_t)
> diff --git a/xen/arch/x86/include/asm/bootinfo.h
> b/xen/arch/x86/include/asm/bootinfo.h
> index 4f2cc5906e59..b3a6b2acf3ac 100644
> --- a/xen/arch/x86/include/asm/bootinfo.h
> +++ b/xen/arch/x86/include/asm/bootinfo.h
> @@ -75,7 +75,7 @@ static inline unsigned int __init
> next_boot_module_index(
> #define for_each_boot_module_by_type(i, b, t) \
> for ( (i) = first_boot_module_index(b, t); \
> (i) <= (b)->nr_modules; \
> - (i) = next_boot_module_index(b, t, i + 1) )
> + (i) = next_boot_module_index(b, t, (i) + 1) )
>
> #endif /* X86_BOOTINFO_H */
>
> diff --git a/xen/arch/x86/mm/shadow/multi.c
> b/xen/arch/x86/mm/shadow/multi.c
> index 3bbaceec1287..9de60720db20 100644
> --- a/xen/arch/x86/mm/shadow/multi.c
> +++ b/xen/arch/x86/mm/shadow/multi.c
> @@ -793,7 +793,7 @@ do {
> \
> do {
> \
> int __done = 0;
> \
> _FOREACH_PRESENT_L1E(_sl1mfn, _sl1e, _gl1p,
> \
> - ({ (__done = _done); }), _code);
> \
> + ({ (__done = (_done)); }), _code);
> \
> _sl1mfn = sh_next_page(_sl1mfn);
> \
> if ( !__done )
> \
> _FOREACH_PRESENT_L1E(_sl1mfn, _sl1e, _gl1p, _done, _code);
> \
> diff --git a/xen/common/kimage.c b/xen/common/kimage.c
> index e1aec5a18a54..972301368443 100644
> --- a/xen/common/kimage.c
> +++ b/xen/common/kimage.c
> @@ -491,11 +491,12 @@ static void kimage_terminate(struct kexec_image
> *image)
> * Call unmap_domain_page(ptr) after the loop exits.
> */
> #define for_each_kimage_entry(image, ptr, entry)
> \
> - for ( ptr = map_domain_page(_mfn(paddr_to_pfn(image->head)));
> \
> - (entry = *ptr) && !(entry & IND_DONE);
> \
> - ptr = (entry & IND_INDIRECTION) ?
> \
> - (unmap_domain_page(ptr),
> map_domain_page(_mfn(paddr_to_pfn(entry)))) \
> - : ptr + 1 )
> + for ( (ptr) = map_domain_page(_mfn(paddr_to_pfn((image)->head)));
> \
> + ((entry) = *(ptr)) && !((entry) & IND_DONE);
> \
> + (ptr) = (((entry) & IND_INDIRECTION)
> \
> + ? (unmap_domain_page(ptr),
> \
> + map_domain_page(_mfn(paddr_to_pfn(entry))))
> \
> + : (ptr) + 1) )
>
> static void kimage_free_entry(kimage_entry_t entry)
> {
> diff --git a/xen/common/livepatch.c b/xen/common/livepatch.c
> index 7446533c8cfb..63473925cafb 100644
> --- a/xen/common/livepatch.c
> +++ b/xen/common/livepatch.c
> @@ -664,9 +664,10 @@ static inline int
> livepatch_check_expectations(const struct payload *payload)
> const struct livepatch_elf_sec *__sec =
> livepatch_elf_sec_by_name(elf, section_name); \
> if ( !__sec )
> \
> break;
> \
> - if ( !section_ok(elf, __sec, sizeof(*hook)) || __sec->sec->sh_size
> != sizeof(*hook) ) \
> + if ( !section_ok(elf, __sec, sizeof(*(hook))) ||
> \
> + __sec->sec->sh_size != sizeof(*(hook)) )
> \
> return -EINVAL;
> \
> - hook = __sec->addr;
> \
> + (hook) = __sec->addr;
> \
This is not strictly needed, if not for consistency
> } while (0)
>
> /*
> @@ -678,10 +679,10 @@ static inline int
> livepatch_check_expectations(const struct payload *payload)
> const struct livepatch_elf_sec *__sec =
> livepatch_elf_sec_by_name(elf, section_name); \
> if ( !__sec )
> \
> break;
> \
> - if ( !section_ok(elf, __sec, sizeof(*hook)) )
> \
> + if ( !section_ok(elf, __sec, sizeof(*(hook))) )
> \
> return -EINVAL;
> \
> - hook = __sec->addr;
> \
> - nhooks = __sec->sec->sh_size / sizeof(*hook);
> \
> + (hook) = __sec->addr;
> \
> + (nhooks) = __sec->sec->sh_size / sizeof(*(hook));
> \
same as above
> } while (0)
>
> static int prepare_payload(struct payload *payload,
> diff --git a/xen/crypto/vmac.c b/xen/crypto/vmac.c
> index c9914d2c7c1d..c7aa1e9be3b9 100644
> --- a/xen/crypto/vmac.c
> +++ b/xen/crypto/vmac.c
> @@ -203,7 +203,7 @@ const uint64_t mpoly =
> UINT64_C(0x1fffffff1fffffff); /* Poly key mask */
> #define nh_16(mp, kp, nw, rh, rl)
> \
> { int i; uint64_t th, tl;
> \
> rh = rl = 0;
> \
> - for (i = 0; i < nw; i+= 2) {
> \
> + for (i = 0; i < (nw); i+= 2) {
> \
> MUL64(th,tl,get64PE((mp)+i )+(kp)[i
> ],get64PE((mp)+i+1)+(kp)[i+1]);\
> ADD128(rh,rl,th,tl);
> \
> }
> \
> @@ -211,7 +211,7 @@ const uint64_t mpoly =
> UINT64_C(0x1fffffff1fffffff); /* Poly key mask */
> #define nh_16_2(mp, kp, nw, rh, rl, rh1, rl1)
> \
> { int i; uint64_t th, tl;
> \
> rh1 = rl1 = rh = rl = 0;
> \
> - for (i = 0; i < nw; i+= 2) {
> \
> + for (i = 0; i < (nw); i+= 2) {
> \
> MUL64(th,tl,get64PE((mp)+i )+(kp)[i
> ],get64PE((mp)+i+1)+(kp)[i+1]);\
> ADD128(rh,rl,th,tl);
> \
> MUL64(th,tl,get64PE((mp)+i
> )+(kp)[i+2],get64PE((mp)+i+1)+(kp)[i+3]);\
> @@ -223,7 +223,7 @@ const uint64_t mpoly =
> UINT64_C(0x1fffffff1fffffff); /* Poly key mask */
> #define nh_vmac_nhbytes(mp, kp, nw, rh, rl)
> \
> { int i; uint64_t th, tl;
> \
> rh = rl = 0;
> \
> - for (i = 0; i < nw; i+= 8) {
> \
> + for (i = 0; i < (nw); i+= 8) {
> \
> MUL64(th,tl,get64PE((mp)+i )+(kp)[i
> ],get64PE((mp)+i+1)+(kp)[i+1]);\
> ADD128(rh,rl,th,tl);
> \
>
> MUL64(th,tl,get64PE((mp)+i+2)+(kp)[i+2],get64PE((mp)+i+3)+(kp)[i+3]);\
> @@ -237,7 +237,7 @@ const uint64_t mpoly =
> UINT64_C(0x1fffffff1fffffff); /* Poly key mask */
> #define nh_vmac_nhbytes_2(mp, kp, nw, rh, rl, rh1, rl1)
> \
> { int i; uint64_t th, tl;
> \
> rh1 = rl1 = rh = rl = 0;
> \
> - for (i = 0; i < nw; i+= 8) {
> \
> + for (i = 0; i < (nw); i+= 8) {
> \
> MUL64(th,tl,get64PE((mp)+i )+(kp)[i
> ],get64PE((mp)+i+1)+(kp)[i+1]);\
> ADD128(rh,rl,th,tl);
> \
> MUL64(th,tl,get64PE((mp)+i
> )+(kp)[i+2],get64PE((mp)+i+1)+(kp)[i+3]);\
> diff --git a/xen/include/xen/libfdt/libfdt.h
> b/xen/include/xen/libfdt/libfdt.h
> index fabddbee8cec..1b09bba28eea 100644
> --- a/xen/include/xen/libfdt/libfdt.h
> +++ b/xen/include/xen/libfdt/libfdt.h
> @@ -230,9 +230,9 @@ int fdt_next_subnode(const void *fdt, int offset);
> * literal.
> */
> #define fdt_for_each_subnode(node, fdt, parent) \
> - for (node = fdt_first_subnode(fdt, parent); \
> - node >= 0; \
> - node = fdt_next_subnode(fdt, node))
> + for ((node) = fdt_first_subnode(fdt, parent); \
> + (node) >= 0; \
> + (node) = fdt_next_subnode(fdt, node))
>
>
> /**********************************************************************/
> /* General functions
> */
--
Nicola Vetrini, B.Sc.
Software Engineer
BUGSENG (https://bugseng.com)
LinkedIn: https://www.linkedin.com/in/nicola-vetrini-a42471253
next prev parent reply other threads:[~2026-02-20 22:45 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-20 21:46 [PATCH 00/12] xen: Misc MISRA fixes for *-allcode targets Andrew Cooper
2026-02-20 21:46 ` [PATCH 01/12] arm: Use __func__ in acpi_boot_table_init() Andrew Cooper
2026-02-20 21:58 ` Nicola Vetrini
2026-02-23 8:54 ` Orzel, Michal
2026-02-20 21:46 ` [PATCH 02/12] xen/treewide: Adjust suffixes on integer literals Andrew Cooper
2026-02-23 8:57 ` Orzel, Michal
2026-02-20 21:46 ` [PATCH 03/12] xen/argo: Fix MISRA violations around function parameters Andrew Cooper
2026-02-23 9:15 ` Jan Beulich
2026-03-03 12:48 ` Daniel Smith
2026-02-20 21:46 ` [PATCH 04/12] xen/treewide: Adjust parameter names and types Andrew Cooper
2026-02-23 8:58 ` Orzel, Michal
2026-02-20 21:46 ` [PATCH 05/12] x86: Adjust annotations of asm-used identifiers Andrew Cooper
2026-02-23 9:21 ` Jan Beulich
2026-02-20 21:46 ` [PATCH 06/12] xen: Include suitable headers to make declarations visible Andrew Cooper
2026-02-23 10:44 ` Jan Beulich
2026-02-20 21:46 ` [PATCH 07/12] xen/vmac: Const the key parameter of vmac_set_key() Andrew Cooper
2026-02-23 10:45 ` Jan Beulich
2026-02-20 21:46 ` [PATCH 08/12] arm/pci-designware: Fix MISRA violations Andrew Cooper
2026-02-20 22:15 ` Nicola Vetrini
2026-02-23 9:00 ` Orzel, Michal
2026-02-20 21:46 ` [PATCH 09/12] x86/shadow: Rework write_atomic() call in shadow_write_entries() Andrew Cooper
2026-02-20 22:28 ` Nicola Vetrini
2026-02-23 7:26 ` Roberto Bagnara
2026-02-25 12:14 ` Andrew Cooper
2026-02-25 12:35 ` Nicola Vetrini
2026-02-25 12:53 ` Andrew Cooper
2026-02-25 13:09 ` Nicola Vetrini
2026-02-20 21:46 ` [PATCH 10/12] xen: Adjust break/fallthrough statements Andrew Cooper
2026-02-20 22:36 ` Nicola Vetrini
2026-02-23 9:02 ` Orzel, Michal
2026-02-20 21:46 ` [PATCH 11/12] xen: Bracket uses of macro parameters Andrew Cooper
2026-02-20 22:45 ` Nicola Vetrini [this message]
2026-02-25 16:05 ` Andrew Cooper
2026-02-25 16:34 ` Nicola Vetrini
2026-02-25 16:39 ` Andrew Cooper
2026-02-23 9:04 ` Orzel, Michal
2026-02-23 10:50 ` Jan Beulich
2026-02-20 21:46 ` [PATCH 12/12] xen/vmac: Delete STDINT block in vmac.h Andrew Cooper
2026-02-23 10:54 ` Jan Beulich
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=a917dc27a7fba87a8f829558444545bb@bugseng.com \
--to=nicola.vetrini@bugseng.com \
--cc=JBeulich@suse.com \
--cc=Volodymyr_Babchuk@epam.com \
--cc=andrew.cooper3@citrix.com \
--cc=bertrand.marquis@arm.com \
--cc=consulting@bugseng.com \
--cc=julien@xen.org \
--cc=michal.orzel@amd.com \
--cc=roger.pau@citrix.com \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/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.