mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
arm/efi: address MISRA C Rule 11.3
MISRA C Rule 11.3 prohibits casting between pointer-to-object types that are different types. The original code used a macro 'NextMemoryDescriptor()' that performed a non-compliant cast from 'UINT8*' to 'EFI_MEMORY_DESCRIPTOR*'. Change 'efi_process_memory_map_bootinfo()' function parameter from 'EFI_MEMORY_DESCRIPTOR *' to 'void *' for the memory map parameter. Replace usage of 'NextMemoryDescriptor()' macro with compliant pointer arithmetic on 'void *', followed by a single compliant cast to 'EFI_MEMORY_DESCRIPTOR *'. Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@epam.com> Reviewed-by: Michal Orzel <michal.orzel@amd.com>
This commit is contained in:
1 parent
b27eedee70
commit
6c9b894a58
1 file changed
+3
-3
@@ -191,15 +191,16 @@ static bool __init meminfo_add_bank(struct membanks *mem,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static EFI_STATUS __init efi_process_memory_map_bootinfo(EFI_MEMORY_DESCRIPTOR *map,
|
static EFI_STATUS __init efi_process_memory_map_bootinfo(void *map,
|
||||||
UINTN mmap_size,
|
UINTN mmap_size,
|
||||||
UINTN desc_size)
|
UINTN desc_size)
|
||||||
{
|
{
|
||||||
int Index;
|
int Index;
|
||||||
EFI_MEMORY_DESCRIPTOR *desc_ptr = map;
|
|
||||||
|
|
||||||
for ( Index = 0; Index < (mmap_size / desc_size); Index++ )
|
for ( Index = 0; Index < (mmap_size / desc_size); Index++ )
|
||||||
{
|
{
|
||||||
|
EFI_MEMORY_DESCRIPTOR *desc_ptr = map + desc_size * Index;
|
||||||
|
|
||||||
if ( !(desc_ptr->Attribute & EFI_MEMORY_RUNTIME) &&
|
if ( !(desc_ptr->Attribute & EFI_MEMORY_RUNTIME) &&
|
||||||
(desc_ptr->Attribute & EFI_MEMORY_WB) &&
|
(desc_ptr->Attribute & EFI_MEMORY_WB) &&
|
||||||
(desc_ptr->Type == EfiConventionalMemory ||
|
(desc_ptr->Type == EfiConventionalMemory ||
|
||||||
@@ -227,7 +228,6 @@ static EFI_STATUS __init efi_process_memory_map_bootinfo(EFI_MEMORY_DESCRIPTOR *
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
desc_ptr = NextMemoryDescriptor(desc_ptr, desc_size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
|||||||