[XEN PATCH 00/13] xen: fixed violations of MISRA C:2012 Rule 7.2

Simone Ballarin posted 13 patches 10 months, 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/cover.1687250177.git.gianluca.luparini@bugseng.com
xen/arch/arm/domain_build.c                  |   2 +-
xen/arch/arm/efi/efi-boot.h                  |   2 +-
xen/arch/arm/gic-v2.c                        |   6 +-
xen/arch/arm/include/asm/arm64/brk.h         |   2 +-
xen/arch/arm/include/asm/arm64/efibind.h     |  10 +-
xen/arch/arm/include/asm/arm64/insn.h        |  16 +-
xen/arch/arm/include/asm/vreg.h              |   2 +-
xen/arch/arm/kernel.c                        |   2 +-
xen/arch/arm/traps.c                         |   4 +-
xen/arch/arm/vgic-v2.c                       |   2 +-
xen/arch/x86/acpi/cpufreq/powernow.c         |  14 +-
xen/arch/x86/apic.c                          |   2 +-
xen/arch/x86/cpu-policy.c                    |   8 +-
xen/arch/x86/cpu/mcheck/mce-apei.c           |   8 +-
xen/arch/x86/cpu/vpmu_intel.c                |   4 +-
xen/arch/x86/cpuid.c                         |   8 +-
xen/arch/x86/efi/efi-boot.h                  |   6 +-
xen/arch/x86/hvm/hypercall.c                 |   2 +-
xen/arch/x86/hvm/irq.c                       |   2 +-
xen/arch/x86/hvm/pmtimer.c                   |   4 +-
xen/arch/x86/hvm/stdvga.c                    |  66 +++---
xen/arch/x86/hvm/svm/asid.c                  |   2 +-
xen/arch/x86/hvm/svm/svm.c                   |   8 +-
xen/arch/x86/hvm/viridian/viridian.c         |   2 +-
xen/arch/x86/hvm/vlapic.c                    |   6 +-
xen/arch/x86/hvm/vmx/vmcs.c                  |   6 +-
xen/arch/x86/hvm/vmx/vvmx.c                  |  12 +-
xen/arch/x86/include/asm/apicdef.h           |   2 +-
xen/arch/x86/include/asm/config.h            |   2 +-
xen/arch/x86/include/asm/guest/hyperv-tlfs.h |  28 +--
xen/arch/x86/include/asm/hpet.h              |   2 +-
xen/arch/x86/include/asm/hvm/trace.h         |   4 +-
xen/arch/x86/include/asm/hvm/vioapic.h       |   2 +-
xen/arch/x86/include/asm/hvm/vmx/vmcs.h      |   6 +-
xen/arch/x86/include/asm/hvm/vmx/vmx.h       |  32 +--
xen/arch/x86/include/asm/msi.h               |   2 +-
xen/arch/x86/include/asm/msr-index.h         | 204 +++++++++----------
xen/arch/x86/include/asm/pci.h               |   8 +-
xen/arch/x86/include/asm/x86-defns.h         |  24 +--
xen/arch/x86/include/asm/x86_64/efibind.h    |  10 +-
xen/arch/x86/monitor.c                       |   6 +-
xen/arch/x86/percpu.c                        |   2 +-
xen/arch/x86/psr.c                           |   2 +-
xen/arch/x86/spec_ctrl.c                     |   8 +-
xen/arch/x86/x86_64/acpi_mmcfg.c             |   2 +-
xen/arch/x86/x86_64/pci.c                    |   2 +-
xen/arch/x86/x86_emulate/x86_emulate.h       |   2 +-
xen/common/device_tree.c                     |   4 +-
xen/common/efi/boot.c                        |   8 +-
xen/common/efi/runtime.c                     |   2 +-
xen/common/gunzip.c                          |   2 +-
xen/common/xmalloc_tlsf.c                    |   2 +-
xen/drivers/char/ehci-dbgp.c                 |   4 +-
xen/drivers/passthrough/amd/iommu-defs.h     | 122 +++++------
xen/drivers/passthrough/pci.c                |   4 +-
xen/drivers/vpci/msi.c                       |   2 +-
xen/drivers/vpci/msix.c                      |   2 +-
xen/drivers/vpci/vpci.c                      |   6 +-
xen/include/acpi/cpufreq/processor_perf.h    |   2 +-
xen/include/efi/efiapi.h                     |  10 +-
xen/include/efi/efidef.h                     |   2 +-
xen/include/efi/efiprot.h                    |  22 +-
xen/include/public/arch-arm/smccc.h          |   8 +-
xen/include/public/arch-x86/xen-x86_64.h     |   8 +-
xen/include/public/io/ring.h                 |  10 +-
xen/include/public/memory.h                  |   2 +-
xen/include/public/sysctl.h                  |   4 +-
xen/include/xen/bitops.h                     |  10 +-
xen/include/xen/cper.h                       |  34 ++--
xen/include/xen/libfdt/fdt.h                 |   2 +-
xen/include/xen/libfdt/libfdt.h              |   2 +-
xen/lib/muldiv64.c                           |   2 +-
xen/lib/x86/cpuid.c                          |   8 +-
xen/lib/x86/policy.c                         |   2 +-
74 files changed, 422 insertions(+), 422 deletions(-)
[XEN PATCH 00/13] xen: fixed violations of MISRA C:2012 Rule 7.2
Posted by Simone Ballarin 10 months, 1 week ago
From: Gianluca Luparini <gianluca.luparini@bugseng.com>

The xen sources contains violations of MISRA C:2012 Rule 7.2 whose headline 
states:
"A "u" or "U" suffix shall be applied to all integer constants that are 
represented in an unsigned type".

These violations are caused by the missing "u" or "U" suffix in unsigned 
integer constants, such as:

xen/arch/x86/hvm/hypercall.c:132.17-132.26
if ( (eax & 0x80000000) && is_viridian_domain(currd) )

The patches in this series achieve compliance for MISRA C:2012 Rule 7.2
by adding the "U" suffix to explicitly state when an integer constant is
represented in an unsigned type.

Some changes are proposed for homogeneity in order to keep the code as
unambiguous as possible.


Gianluca Luparini (13):
  xen/x86: fixed violations of MISRA C:2012 Rule 7.2
  AMD/IOMMU: fixed violations of MISRA C:2012 Rule 7.2
  xen/x86: fixed violations of MISRA C:2012 Rule 7.2
  xen/arm: fixed violations of MISRA C:2012 Rule 7.2
  xen/common: fixed violations of MISRA C:2012 Rule 7.2
  xen/efi: fixed violations of MISRA C:2012 Rule 7.2
  xen/x86: fixed violations of MISRA C:2012 Rule 7.2
  xen/pci: fixed violations of MISRA C:2012 Rule 7.2
  xen/public: fixed violations of MISRA C:2012 Rule 7.2
  xen/x86: fixed violations of MISRA C:2012 Rule 7.2
  xen/vpci: fixed violations of MISRA C:2012 Rule 7.2
  xen/x86: fixed violations of MISRA C:2012 Rule 7.2
  xen: fixed violations of MISRA C:2012 Rule 7.2

 xen/arch/arm/domain_build.c                  |   2 +-
 xen/arch/arm/efi/efi-boot.h                  |   2 +-
 xen/arch/arm/gic-v2.c                        |   6 +-
 xen/arch/arm/include/asm/arm64/brk.h         |   2 +-
 xen/arch/arm/include/asm/arm64/efibind.h     |  10 +-
 xen/arch/arm/include/asm/arm64/insn.h        |  16 +-
 xen/arch/arm/include/asm/vreg.h              |   2 +-
 xen/arch/arm/kernel.c                        |   2 +-
 xen/arch/arm/traps.c                         |   4 +-
 xen/arch/arm/vgic-v2.c                       |   2 +-
 xen/arch/x86/acpi/cpufreq/powernow.c         |  14 +-
 xen/arch/x86/apic.c                          |   2 +-
 xen/arch/x86/cpu-policy.c                    |   8 +-
 xen/arch/x86/cpu/mcheck/mce-apei.c           |   8 +-
 xen/arch/x86/cpu/vpmu_intel.c                |   4 +-
 xen/arch/x86/cpuid.c                         |   8 +-
 xen/arch/x86/efi/efi-boot.h                  |   6 +-
 xen/arch/x86/hvm/hypercall.c                 |   2 +-
 xen/arch/x86/hvm/irq.c                       |   2 +-
 xen/arch/x86/hvm/pmtimer.c                   |   4 +-
 xen/arch/x86/hvm/stdvga.c                    |  66 +++---
 xen/arch/x86/hvm/svm/asid.c                  |   2 +-
 xen/arch/x86/hvm/svm/svm.c                   |   8 +-
 xen/arch/x86/hvm/viridian/viridian.c         |   2 +-
 xen/arch/x86/hvm/vlapic.c                    |   6 +-
 xen/arch/x86/hvm/vmx/vmcs.c                  |   6 +-
 xen/arch/x86/hvm/vmx/vvmx.c                  |  12 +-
 xen/arch/x86/include/asm/apicdef.h           |   2 +-
 xen/arch/x86/include/asm/config.h            |   2 +-
 xen/arch/x86/include/asm/guest/hyperv-tlfs.h |  28 +--
 xen/arch/x86/include/asm/hpet.h              |   2 +-
 xen/arch/x86/include/asm/hvm/trace.h         |   4 +-
 xen/arch/x86/include/asm/hvm/vioapic.h       |   2 +-
 xen/arch/x86/include/asm/hvm/vmx/vmcs.h      |   6 +-
 xen/arch/x86/include/asm/hvm/vmx/vmx.h       |  32 +--
 xen/arch/x86/include/asm/msi.h               |   2 +-
 xen/arch/x86/include/asm/msr-index.h         | 204 +++++++++----------
 xen/arch/x86/include/asm/pci.h               |   8 +-
 xen/arch/x86/include/asm/x86-defns.h         |  24 +--
 xen/arch/x86/include/asm/x86_64/efibind.h    |  10 +-
 xen/arch/x86/monitor.c                       |   6 +-
 xen/arch/x86/percpu.c                        |   2 +-
 xen/arch/x86/psr.c                           |   2 +-
 xen/arch/x86/spec_ctrl.c                     |   8 +-
 xen/arch/x86/x86_64/acpi_mmcfg.c             |   2 +-
 xen/arch/x86/x86_64/pci.c                    |   2 +-
 xen/arch/x86/x86_emulate/x86_emulate.h       |   2 +-
 xen/common/device_tree.c                     |   4 +-
 xen/common/efi/boot.c                        |   8 +-
 xen/common/efi/runtime.c                     |   2 +-
 xen/common/gunzip.c                          |   2 +-
 xen/common/xmalloc_tlsf.c                    |   2 +-
 xen/drivers/char/ehci-dbgp.c                 |   4 +-
 xen/drivers/passthrough/amd/iommu-defs.h     | 122 +++++------
 xen/drivers/passthrough/pci.c                |   4 +-
 xen/drivers/vpci/msi.c                       |   2 +-
 xen/drivers/vpci/msix.c                      |   2 +-
 xen/drivers/vpci/vpci.c                      |   6 +-
 xen/include/acpi/cpufreq/processor_perf.h    |   2 +-
 xen/include/efi/efiapi.h                     |  10 +-
 xen/include/efi/efidef.h                     |   2 +-
 xen/include/efi/efiprot.h                    |  22 +-
 xen/include/public/arch-arm/smccc.h          |   8 +-
 xen/include/public/arch-x86/xen-x86_64.h     |   8 +-
 xen/include/public/io/ring.h                 |  10 +-
 xen/include/public/memory.h                  |   2 +-
 xen/include/public/sysctl.h                  |   4 +-
 xen/include/xen/bitops.h                     |  10 +-
 xen/include/xen/cper.h                       |  34 ++--
 xen/include/xen/libfdt/fdt.h                 |   2 +-
 xen/include/xen/libfdt/libfdt.h              |   2 +-
 xen/lib/muldiv64.c                           |   2 +-
 xen/lib/x86/cpuid.c                          |   8 +-
 xen/lib/x86/policy.c                         |   2 +-
 74 files changed, 422 insertions(+), 422 deletions(-)

-- 
2.41.0
Re: [XEN PATCH 00/13] xen: fixed violations of MISRA C:2012 Rule 7.2
Posted by Jan Beulich 10 months, 1 week ago
On 20.06.2023 12:34, Simone Ballarin wrote:
> From: Gianluca Luparini <gianluca.luparini@bugseng.com>
> 
> The xen sources contains violations of MISRA C:2012 Rule 7.2 whose headline 
> states:
> "A "u" or "U" suffix shall be applied to all integer constants that are 
> represented in an unsigned type".
> 
> These violations are caused by the missing "u" or "U" suffix in unsigned 
> integer constants, such as:
> 
> xen/arch/x86/hvm/hypercall.c:132.17-132.26
> if ( (eax & 0x80000000) && is_viridian_domain(currd) )
> 
> The patches in this series achieve compliance for MISRA C:2012 Rule 7.2
> by adding the "U" suffix to explicitly state when an integer constant is
> represented in an unsigned type.
> 
> Some changes are proposed for homogeneity in order to keep the code as
> unambiguous as possible.
> 
> 
> Gianluca Luparini (13):
>   xen/x86: fixed violations of MISRA C:2012 Rule 7.2
>   AMD/IOMMU: fixed violations of MISRA C:2012 Rule 7.2
>   xen/x86: fixed violations of MISRA C:2012 Rule 7.2
>   xen/arm: fixed violations of MISRA C:2012 Rule 7.2
>   xen/common: fixed violations of MISRA C:2012 Rule 7.2
>   xen/efi: fixed violations of MISRA C:2012 Rule 7.2
>   xen/x86: fixed violations of MISRA C:2012 Rule 7.2
>   xen/pci: fixed violations of MISRA C:2012 Rule 7.2
>   xen/public: fixed violations of MISRA C:2012 Rule 7.2
>   xen/x86: fixed violations of MISRA C:2012 Rule 7.2
>   xen/vpci: fixed violations of MISRA C:2012 Rule 7.2
>   xen/x86: fixed violations of MISRA C:2012 Rule 7.2

Please can you avoid having four patches with this exact same title?

Jan

>   xen: fixed violations of MISRA C:2012 Rule 7.2
> 
>  xen/arch/arm/domain_build.c                  |   2 +-
>  xen/arch/arm/efi/efi-boot.h                  |   2 +-
>  xen/arch/arm/gic-v2.c                        |   6 +-
>  xen/arch/arm/include/asm/arm64/brk.h         |   2 +-
>  xen/arch/arm/include/asm/arm64/efibind.h     |  10 +-
>  xen/arch/arm/include/asm/arm64/insn.h        |  16 +-
>  xen/arch/arm/include/asm/vreg.h              |   2 +-
>  xen/arch/arm/kernel.c                        |   2 +-
>  xen/arch/arm/traps.c                         |   4 +-
>  xen/arch/arm/vgic-v2.c                       |   2 +-
>  xen/arch/x86/acpi/cpufreq/powernow.c         |  14 +-
>  xen/arch/x86/apic.c                          |   2 +-
>  xen/arch/x86/cpu-policy.c                    |   8 +-
>  xen/arch/x86/cpu/mcheck/mce-apei.c           |   8 +-
>  xen/arch/x86/cpu/vpmu_intel.c                |   4 +-
>  xen/arch/x86/cpuid.c                         |   8 +-
>  xen/arch/x86/efi/efi-boot.h                  |   6 +-
>  xen/arch/x86/hvm/hypercall.c                 |   2 +-
>  xen/arch/x86/hvm/irq.c                       |   2 +-
>  xen/arch/x86/hvm/pmtimer.c                   |   4 +-
>  xen/arch/x86/hvm/stdvga.c                    |  66 +++---
>  xen/arch/x86/hvm/svm/asid.c                  |   2 +-
>  xen/arch/x86/hvm/svm/svm.c                   |   8 +-
>  xen/arch/x86/hvm/viridian/viridian.c         |   2 +-
>  xen/arch/x86/hvm/vlapic.c                    |   6 +-
>  xen/arch/x86/hvm/vmx/vmcs.c                  |   6 +-
>  xen/arch/x86/hvm/vmx/vvmx.c                  |  12 +-
>  xen/arch/x86/include/asm/apicdef.h           |   2 +-
>  xen/arch/x86/include/asm/config.h            |   2 +-
>  xen/arch/x86/include/asm/guest/hyperv-tlfs.h |  28 +--
>  xen/arch/x86/include/asm/hpet.h              |   2 +-
>  xen/arch/x86/include/asm/hvm/trace.h         |   4 +-
>  xen/arch/x86/include/asm/hvm/vioapic.h       |   2 +-
>  xen/arch/x86/include/asm/hvm/vmx/vmcs.h      |   6 +-
>  xen/arch/x86/include/asm/hvm/vmx/vmx.h       |  32 +--
>  xen/arch/x86/include/asm/msi.h               |   2 +-
>  xen/arch/x86/include/asm/msr-index.h         | 204 +++++++++----------
>  xen/arch/x86/include/asm/pci.h               |   8 +-
>  xen/arch/x86/include/asm/x86-defns.h         |  24 +--
>  xen/arch/x86/include/asm/x86_64/efibind.h    |  10 +-
>  xen/arch/x86/monitor.c                       |   6 +-
>  xen/arch/x86/percpu.c                        |   2 +-
>  xen/arch/x86/psr.c                           |   2 +-
>  xen/arch/x86/spec_ctrl.c                     |   8 +-
>  xen/arch/x86/x86_64/acpi_mmcfg.c             |   2 +-
>  xen/arch/x86/x86_64/pci.c                    |   2 +-
>  xen/arch/x86/x86_emulate/x86_emulate.h       |   2 +-
>  xen/common/device_tree.c                     |   4 +-
>  xen/common/efi/boot.c                        |   8 +-
>  xen/common/efi/runtime.c                     |   2 +-
>  xen/common/gunzip.c                          |   2 +-
>  xen/common/xmalloc_tlsf.c                    |   2 +-
>  xen/drivers/char/ehci-dbgp.c                 |   4 +-
>  xen/drivers/passthrough/amd/iommu-defs.h     | 122 +++++------
>  xen/drivers/passthrough/pci.c                |   4 +-
>  xen/drivers/vpci/msi.c                       |   2 +-
>  xen/drivers/vpci/msix.c                      |   2 +-
>  xen/drivers/vpci/vpci.c                      |   6 +-
>  xen/include/acpi/cpufreq/processor_perf.h    |   2 +-
>  xen/include/efi/efiapi.h                     |  10 +-
>  xen/include/efi/efidef.h                     |   2 +-
>  xen/include/efi/efiprot.h                    |  22 +-
>  xen/include/public/arch-arm/smccc.h          |   8 +-
>  xen/include/public/arch-x86/xen-x86_64.h     |   8 +-
>  xen/include/public/io/ring.h                 |  10 +-
>  xen/include/public/memory.h                  |   2 +-
>  xen/include/public/sysctl.h                  |   4 +-
>  xen/include/xen/bitops.h                     |  10 +-
>  xen/include/xen/cper.h                       |  34 ++--
>  xen/include/xen/libfdt/fdt.h                 |   2 +-
>  xen/include/xen/libfdt/libfdt.h              |   2 +-
>  xen/lib/muldiv64.c                           |   2 +-
>  xen/lib/x86/cpuid.c                          |   8 +-
>  xen/lib/x86/policy.c                         |   2 +-
>  74 files changed, 422 insertions(+), 422 deletions(-)
>
Re: [XEN PATCH 00/13] xen: fixed violations of MISRA C:2012 Rule 7.2
Posted by Roger Pau Monné 10 months, 1 week ago
On Tue, Jun 20, 2023 at 12:34:52PM +0200, Simone Ballarin wrote:
> From: Gianluca Luparini <gianluca.luparini@bugseng.com>
> 
> The xen sources contains violations of MISRA C:2012 Rule 7.2 whose headline 
> states:
> "A "u" or "U" suffix shall be applied to all integer constants that are 
> represented in an unsigned type".
> 
> These violations are caused by the missing "u" or "U" suffix in unsigned 
> integer constants, such as:
> 
> xen/arch/x86/hvm/hypercall.c:132.17-132.26
> if ( (eax & 0x80000000) && is_viridian_domain(currd) )
> 
> The patches in this series achieve compliance for MISRA C:2012 Rule 7.2
> by adding the "U" suffix to explicitly state when an integer constant is
> represented in an unsigned type.

I wonder if there should be a patch to CODING_STYLE also as part of
the series?

I know it's in misra/rules.rst, but still it's something that could
easily be added to the CODING_STYLE, unlike other rules that are more
abstract.

We could also settle on whether to use lowercase or uppercase suffixes
uniformly.

Thanks, Roger.