From: Nicola Vetrini <nicola.vetrini@bugseng.com>
To: Luca Fancellu <luca.fancellu@arm.com>
Cc: xen-devel@lists.xenproject.org, consulting@bugseng.com,
Stefano Stabellini <sstabellini@kernel.org>,
Julien Grall <julien@xen.org>,
Bertrand Marquis <bertrand.marquis@arm.com>,
Michal Orzel <michal.orzel@amd.com>,
Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
Subject: Re: [PATCH 2/2] xen/arm: Fix MISRA regression on R1.1, flexible array member not at the end
Date: Tue, 30 Apr 2024 14:55:00 +0200 [thread overview]
Message-ID: <fab66060c4aeec0d3ee9d3f24054a12b@bugseng.com> (raw)
In-Reply-To: <20240430110922.15052-3-luca.fancellu@arm.com>
On 2024-04-30 13:09, Luca Fancellu wrote:
> Commit 2209c1e35b47 ("xen/arm: Introduce a generic way to access memory
> bank structures") introduced a MISRA regression for Rule 1.1 because a
> flexible array member is introduced in the middle of a struct,
> furthermore
> this is using a GCC extension that is going to be deprecated in GCC 14
> and
> a warning to identify such cases will be present
> (-Wflex-array-member-not-at-end) to identify such cases.
>
> In order to fix this issue, use the macro __struct_group to create a
> structure 'struct membanks_hdr' which will hold the common data among
> structures using the 'struct membanks' interface.
>
> Modify the 'struct shared_meminfo' and 'struct meminfo' to use this new
> structure, effectively removing the flexible array member from the
> middle
> of the structure and modify the code accessing the .common field to use
> the macro container_of to maintain the functionality of the interface.
>
> Given this change, container_of needs to be supplied with a type and so
> the macro 'kernel_info_get_mem' inside arm/include/asm/kernel.h can't
> be
> an option since it uses const and non-const types for struct membanks,
> so
> introduce two static inline, one of which will keep the const
> qualifier.
>
> Given the complexity of the interface, which carries a lot of benefit
> but
> on the other hand could be prone to developer confusion if the access
> is
> open-coded, introduce two static inline helper for the
> 'struct kernel_info' .shm_mem member and get rid the open-coding
> shm_mem.common access.
>
> Fixes: 2209c1e35b47 ("xen/arm: Introduce a generic way to access memory
> bank structures")
> Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
> ---
> xen/arch/arm/acpi/domain_build.c | 2 +-
> xen/arch/arm/domain_build.c | 6 +++---
> xen/arch/arm/include/asm/kernel.h | 11 ++++++++++-
> xen/arch/arm/include/asm/setup.h | 18 ++++++++++--------
> xen/arch/arm/include/asm/static-shmem.h | 12 ++++++++++++
> xen/arch/arm/static-shmem.c | 19 +++++++++----------
> 6 files changed, 45 insertions(+), 23 deletions(-)
>
From a MISRA perspective the regression on R1.1 is resolved (see [1]).
[1] https://gitlab.com/xen-project/patchew/xen/-/jobs/6748211368
--
Nicola Vetrini, BSc
Software Engineer, BUGSENG srl (https://bugseng.com)
next prev parent reply other threads:[~2024-04-30 12:55 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-30 11:09 [PATCH 0/2] Fix MISRA regression about flexible array member not at the end Luca Fancellu
2024-04-30 11:09 ` [PATCH 1/2] xen/kernel.h: Import __struct_group from Linux Luca Fancellu
2024-04-30 11:43 ` Jan Beulich
2024-05-01 6:54 ` Luca Fancellu
2024-05-02 6:09 ` Jan Beulich
2024-05-02 6:23 ` Luca Fancellu
2024-05-02 6:38 ` Jan Beulich
2024-05-02 18:23 ` Stefano Stabellini
2024-04-30 11:09 ` [PATCH 2/2] xen/arm: Fix MISRA regression on R1.1, flexible array member not at the end Luca Fancellu
2024-04-30 11:37 ` Jan Beulich
2024-05-01 6:57 ` Luca Fancellu
2024-05-02 6:14 ` Jan Beulich
2024-05-02 6:33 ` Luca Fancellu
2024-05-02 6:43 ` Jan Beulich
2024-05-02 8:13 ` Luca Fancellu
2024-05-02 9:53 ` Jan Beulich
2024-05-02 10:12 ` Luca Fancellu
2024-05-02 10:30 ` Jan Beulich
2024-05-02 10:42 ` Luca Fancellu
2024-04-30 12:55 ` Nicola Vetrini [this message]
2024-05-02 18:35 ` Stefano Stabellini
2024-05-08 16:18 ` Luca Fancellu
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=fab66060c4aeec0d3ee9d3f24054a12b@bugseng.com \
--to=nicola.vetrini@bugseng.com \
--cc=Volodymyr_Babchuk@epam.com \
--cc=bertrand.marquis@arm.com \
--cc=consulting@bugseng.com \
--cc=julien@xen.org \
--cc=luca.fancellu@arm.com \
--cc=michal.orzel@amd.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.