Hi Dmytro,

> On 31 Oct 2025, at 16:02, Dmytro Prokopchuk1 <[email protected]> 
> wrote:
> 
> The current implementation of 'free_init_memory()' fills the freed '__init'
> and '__initdata' memory regions with a faulting instruction before unmapping
> and returning them to the heap. However, after unmapping, any access to this
> region will result in a page fault, making the instruction fill redundant.
> 
> Replace the instruction fill with a call to 'memset()', zeroing the entire
> region before it is unmapped and returned to the allocator.
> 
> Additionally, this change resolves a violation of MISRA C:2012 Rule 11.3
> (cast between pointer to object type and pointer to a different object type),
> caused by performing a cast from a 'char *' to a 'uint32_t *' pointer to
> write instructions directly into memory, which is not compliant with MISRA
> guidelines.
> 
> No functional changes.
> 
> Signed-off-by: Dmytro Prokopchuk <[email protected]>
> Acked-by: Julien Grall <[email protected]>
> ---

Looks good to me, I’ve also tested on Arm64 and Arm32 qemu.

Reviewed-by: Luca Fancellu <[email protected]>
Tested-by: Luca Fancellu <[email protected]>

Cheers,
Luca

Reply via email to