All of lore.kernel.org
 help / color / mirror / Atom feed
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>,
	"consulting @ bugseng . com" <consulting@bugseng.com>
Subject: Re: [PATCH 1/5] x86: Misra fixes for U/L suffixes
Date: Wed, 10 Dec 2025 21:09:45 +0100	[thread overview]
Message-ID: <c9c7deeecc839295d04c5374691f848d@bugseng.com> (raw)
In-Reply-To: <20251210183019.2241560-2-andrew.cooper3@citrix.com>

On 2025-12-10 19:30, Andrew Cooper wrote:
> With the wider testing, some more violations have been spotted.  This
> addresses violations of Rule 7.2 (suffixes required) and Rule 7.3 (L 
> must be
> uppercase).
> 
> For ELF64_R_TYPE(), cast to uint32_t matching the surrounding examples.
> 
> No functional change.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Reviewed-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
> ---
> CC: Jan Beulich <JBeulich@suse.com>
> CC: Roger Pau Monné <roger.pau@citrix.com>
> CC: Stefano Stabellini <sstabellini@kernel.org>
> CC: consulting@bugseng.com <consulting@bugseng.com>
> CC: Nicola Vetrini <nicola.vetrini@bugseng.com>
> ---
>  xen/arch/x86/mm/shadow/common.c     | 4 ++--
>  xen/arch/x86/pv/descriptor-tables.c | 2 +-
>  xen/drivers/passthrough/vtd/iommu.h | 2 +-
>  xen/include/xen/elfstructs.h        | 2 +-
>  xen/include/xen/sizes.h             | 2 +-
>  5 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/xen/arch/x86/mm/shadow/common.c 
> b/xen/arch/x86/mm/shadow/common.c
> index 0176e33bc9c7..423764a32653 100644
> --- a/xen/arch/x86/mm/shadow/common.c
> +++ b/xen/arch/x86/mm/shadow/common.c
> @@ -1961,7 +1961,7 @@ int sh_remove_write_access(struct domain *d, 
> mfn_t gmfn,
>               /* FreeBSD 64bit: linear map 0xffff800000000000 */
>               switch ( level )
>               {
> -             case 1: GUESS(0xffff800000000000
> +             case 1: GUESS(0xffff800000000000UL
>                             + ((fault_addr & VADDR_MASK) >> 9), 6); 
> break;
>               case 2: GUESS(0xffff804000000000UL
>                             + ((fault_addr & VADDR_MASK) >> 18), 6); 
> break;
> @@ -1969,7 +1969,7 @@ int sh_remove_write_access(struct domain *d, 
> mfn_t gmfn,
>                             + ((fault_addr & VADDR_MASK) >> 27), 6); 
> break;
>               }
>               /* FreeBSD 64bit: direct map at 0xffffff0000000000 */
> -             GUESS(0xffffff0000000000 + gfn_to_gaddr(gfn), 6);
> +             GUESS(0xffffff0000000000UL + gfn_to_gaddr(gfn), 6);
>          }
> 
>  #undef GUESS
> diff --git a/xen/arch/x86/pv/descriptor-tables.c 
> b/xen/arch/x86/pv/descriptor-tables.c
> index 02647a2c5047..26f7d18b11b5 100644
> --- a/xen/arch/x86/pv/descriptor-tables.c
> +++ b/xen/arch/x86/pv/descriptor-tables.c
> @@ -216,7 +216,7 @@ static bool check_descriptor(const struct domain 
> *dom, seg_desc_t *d)
>               * 0xf6800000. Extend these to allow access to the larger 
> read-only
>               * M2P table available in 32on64 mode.
>               */
> -            base = (b & 0xff000000) | ((b & 0xff) << 16) | (a >> 16);
> +            base = (b & 0xff000000U) | ((b & 0xff) << 16) | (a >> 16);
> 
>              limit = (b & 0xf0000) | (a & 0xffff);
>              limit++; /* We add one because limit is inclusive. */
> diff --git a/xen/drivers/passthrough/vtd/iommu.h 
> b/xen/drivers/passthrough/vtd/iommu.h
> index 29d350b23db6..4f41360c53c0 100644
> --- a/xen/drivers/passthrough/vtd/iommu.h
> +++ b/xen/drivers/passthrough/vtd/iommu.h
> @@ -266,7 +266,7 @@ struct dma_pte {
>  #define DMA_PTE_PROT (DMA_PTE_READ | DMA_PTE_WRITE)
>  #define DMA_PTE_SP   (1 << 7)
>  #define DMA_PTE_SNP  (1 << 11)
> -#define DMA_PTE_CONTIG_MASK  (0xfull << PADDR_BITS)
> +#define DMA_PTE_CONTIG_MASK  (0xfULL << PADDR_BITS)
>  #define dma_clear_pte(p)    do {(p).val = 0;} while(0)
>  #define dma_set_pte_readable(p) do {(p).val |= DMA_PTE_READ;} while(0)
>  #define dma_set_pte_writable(p) do {(p).val |= DMA_PTE_WRITE;} 
> while(0)
> diff --git a/xen/include/xen/elfstructs.h 
> b/xen/include/xen/elfstructs.h
> index eb6b87a823a8..8770e7454672 100644
> --- a/xen/include/xen/elfstructs.h
> +++ b/xen/include/xen/elfstructs.h
> @@ -360,7 +360,7 @@ typedef struct {
>  } Elf64_Rela;
> 
>  #define	ELF64_R_SYM(info)	((info) >> 32)
> -#define	ELF64_R_TYPE(info)	((info) & 0xFFFFFFFF)
> +#define	ELF64_R_TYPE(info)	((uint32_t)(info))
>  #define ELF64_R_INFO(s,t) 	(((s) << 32) + (uint32_t)(t))
> 
>  /*
> diff --git a/xen/include/xen/sizes.h b/xen/include/xen/sizes.h
> index f7b728ddab06..d309ebf04406 100644
> --- a/xen/include/xen/sizes.h
> +++ b/xen/include/xen/sizes.h
> @@ -43,6 +43,6 @@
>  #define SZ_512M                         0x20000000
> 
>  #define SZ_1G                           0x40000000
> -#define SZ_2G                           0x80000000
> +#define SZ_2G                           0x80000000U
> 
>  #endif /* __XEN_SIZES_H__ */

-- 
Nicola Vetrini, B.Sc.
Software Engineer
BUGSENG (https://bugseng.com)
LinkedIn: https://www.linkedin.com/in/nicola-vetrini-a42471253


  reply	other threads:[~2025-12-10 20:10 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-10 18:30 [PATCH 0/5] x86: Misc MISRA fixes Andrew Cooper
2025-12-10 18:30 ` [PATCH 1/5] x86: Misra fixes for U/L suffixes Andrew Cooper
2025-12-10 20:09   ` Nicola Vetrini [this message]
2025-12-10 20:31     ` Nicola Vetrini
2025-12-10 23:48       ` Andrew Cooper
2025-12-11  7:39         ` Nicola Vetrini
2025-12-10 18:30 ` [PATCH 2/5] x86: Name parameters in function declarations Andrew Cooper
2025-12-10 20:15   ` Nicola Vetrini
2025-12-12  1:39     ` Andrew Cooper
2025-12-10 18:30 ` [PATCH 3/5] x86/ucode: Don't cast away const-ness in cmp_patch_id() Andrew Cooper
2025-12-10 20:37   ` Nicola Vetrini
2025-12-11  0:06     ` Stefano Stabellini
2025-12-10 18:30 ` [PATCH 4/5] x86: Fix missing breaks Andrew Cooper
2025-12-10 21:04   ` Nicola Vetrini
2025-12-10 18:30 ` [PATCH 5/5] x86: Fix missing brackets in macros Andrew Cooper
2025-12-10 21:11   ` Nicola Vetrini
2025-12-11  0:07     ` Stefano Stabellini
2025-12-11  8:36   ` Jan Beulich
2025-12-11  9:15     ` Nicola Vetrini
2025-12-11  9:30       ` Jan Beulich
2025-12-11 10:38         ` Nicola Vetrini
2025-12-11 12:28           ` Nicola Vetrini
2025-12-12  1:45             ` Andrew Cooper

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=c9c7deeecc839295d04c5374691f848d@bugseng.com \
    --to=nicola.vetrini@bugseng.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=consulting@bugseng.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.