> On 2 May 2024, at 19:35, Stefano Stabellini <[email protected]> wrote:
>
> On Tue, 30 Apr 2024, 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 <[email protected]>
>
> Reviewed-by: Stefano Stabellini <[email protected]>
Hi Stefano,
Thanks!
Is it possible to add, eventually on commit, this tag?
Reported-by: Nicola Vetrini <[email protected]>