[PATCH 0/3] xen: address violations of MISRA C:2012 Rule 14.4

Simone Ballarin posted 3 patches 5 months ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/cover.1701941924.git.maria.celeste.cesario@bugseng.com
There is a newer version of this series
automation/eclair_analysis/ECLAIR/deviations.ecl | 6 ++++++
docs/misra/deviations.rst                        | 6 ++++++
xen/arch/x86/hpet.c                              | 6 +++---
xen/arch/x86/msi.c                               | 4 ++--
xen/arch/x86/x86_emulate/x86_emulate.c           | 8 ++++----
xen/drivers/passthrough/amd/iommu_init.c         | 4 ++--
xen/drivers/passthrough/vtd/iommu.c              | 4 ++--
xen/drivers/passthrough/vtd/quirks.c             | 2 +-
8 files changed, 26 insertions(+), 14 deletions(-)
[PATCH 0/3] xen: address violations of MISRA C:2012 Rule 14.4
Posted by Simone Ballarin 5 months ago
From: Maria Celeste Cesario <maria.celeste.cesario@bugseng.com>

The xen sources contain violations of MISRA C:2012 Rule 14.4 whose
headline states:
"The controlling expression of an if statement and the controlling
expression of an iteration-statement shall have essentially Boolean type".

Add comparisons to avoid using enum constants as controlling expressions
to comply with Rule 14.4.

Example:
    extern enum __packed iommu_intremap {
       iommu_intremap_off,
       iommu_intremap_restricted,
       iommu_intremap_full,
    } iommu_intremap;

    if ( iommu_intremap )                       /* non-compliant */
    if ( iommu_intremap != iommu_intremap_off ) /* compliant, proposed change */

Struct domain member is_dying is an anonymous enum variable designed to act as boolean.
Add deviation to mark its uses in controlling expressions as deliberate.

Maria Celeste Cesario (3):
  AMD/IOMMU: address violations of MISRA C:2012 Rule 14.4
  xen/x86: address violations of MISRA C:2012 Rule 14.4
  xen: address violations of MISRA C:2012 Rule 14.4

 automation/eclair_analysis/ECLAIR/deviations.ecl | 6 ++++++
 docs/misra/deviations.rst                        | 6 ++++++
 xen/arch/x86/hpet.c                              | 6 +++---
 xen/arch/x86/msi.c                               | 4 ++--
 xen/arch/x86/x86_emulate/x86_emulate.c           | 8 ++++----
 xen/drivers/passthrough/amd/iommu_init.c         | 4 ++--
 xen/drivers/passthrough/vtd/iommu.c              | 4 ++--
 xen/drivers/passthrough/vtd/quirks.c             | 2 +-
 8 files changed, 26 insertions(+), 14 deletions(-)

-- 
2.40.0