target/arm: Initialize ARMMMUFaultInfo in v7m_stack_read/write
PATCH 1/1 target/arm: Initialize ARMMMUFaultInfo in v7m_stack_read/write
The get_phys_addr() functions take a pointer to an ARMMMUFaultInfo struct, which they fill in only if a fault occurs. This means that the caller must always zero-initialize the struct before passing it in. We forgot to do this in v7m_stack_read() and v7m_stack_write(). Correct the error.
---
Noticed this in passing while I was working in the file on an entirely different issue.
target/arm/helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
target/arm/helper.c +2 -2
@@ -6469,7 +6469,7 @@ static bool v7m_stack_write(ARMCPU *cpu, uint32_t addr, uint32_t value,target_ulong page_size;hwaddr physaddr;int prot; -ARMMMUFaultInfo fi; +ARMMMUFaultInfo fi = {};bool secure = mmu_idx &ARM_MMU_IDX_M_S ;int exc;bool exc_secure;
@@ -6531,7 +6531,7 @@ static bool v7m_stack_read(ARMCPU *cpu, uint32_t *dest, uint32_t addr,target_ulong page_size;hwaddr physaddr;int prot; -ARMMMUFaultInfo fi; +ARMMMUFaultInfo fi = {};bool secure = mmu_idx &ARM_MMU_IDX_M_S ;int exc;bool exc_secure;
Signature · 1 line
2.19.0
Quoted 6 lines · Peter Maydell
The
get_phys_addr()functions take a pointer to an ARMMMUFaultInfo struct, which they fill in only if a fault occurs. This means that the caller must always zero-initialize the struct before passing it in. We forgot to do this inv7m_stack_read()andv7m_stack_write(). Correct the error.
Quoted 7 lines
Signed-off-by Peter Maydell <[email protected]>---
Noticed this in passing while I was working in the file on an entirely different issue.target/arm/helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
r~