RFC address violations of MISRA C Rule 9.3
Get series with b4
b4 am [email protected]Versions newest first
- v1 RFC Latest4 patches 13 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/4 | x86/ioemul: address MISRA C:2012 Rule 9.3xen/ | +16 | 10 replies | |
| 2/4 | x86/shutdown: address MISRA C:2012 Rule 9.3xen/ | +76 | 2 replies | |
| 3/4 | x86/hvm: quirks: address MISRA C:2012 Rule 9.3xen/ | +10 | 0 replies | |
| 4/4 | amd/iommu: fully initialize array in 'flush_command_buffer'xen/ | +2 | 1 reply |
Reviews trailers per patch
1 of 4 patches has a Reviewed-by or Acked-by.
| Patch | Jan Beulich |
|---|---|
| 1/4 | |
| 2/4 | |
| 3/4 | |
| 4/4 | A-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [RFC 0/4] address violations of MISRA C Rule 9.3
This series addresses some of the violations of Rule 9.3, which is about partially initialized arrays. The resolution strategy proposed in these patches uses designated initializers, except in patch 4, allowed by MISRA for sparse initialization. The reason why I chose this method is that, given that most of the violations are about the 'matches' field of struct 'struct dmi_system_id', which is a sized array of structs:
struct dmi_strmatch matches[4];
Since the initialization is already partially implicit, using designated initalizers is convenient because, if the lenght of the matches array changes, no adjustment is needed
Another, stricter, resolution strategy is the following:
.matches = {
DMI_MATCH(DMI_BOARD_VENDOR, "Quanta"),
- DMI_MATCH(DMI_BOARD_NAME, "30B7"),
+ DMI_MATCH(DMI_BOARD_NAME, "30B7"),
+ {}, {}
}Note that Rule 9.3 is not about array elements that may be uninitialized, but the fact of having some explicitly initialized elements and some implicitly initialized elements.
Nicola Vetrini (4):
x86/ioemul: address MISRA C:2012 Rule 9.3 x86/shutdown: address MISRA C:2012 Rule 9.3 x86/hvm: quirks: address MISRA C:2012 Rule 9.3 amd/iommu: fully initialize array in 'flush_command_buffer'
xen/arch/x86/hvm/quirks.c | 20 ++-- xen/arch/x86/ioport_emulate.c | 32 ++--- xen/arch/x86/shutdown.c | 152 ++++++++++++------------ xen/drivers/passthrough/amd/iommu_cmd.c | 3 +- 4 files changed, 104 insertions(+), 103 deletions(-)
--
2.34.1