From 64661a9165a2ad147f3457755a65bdda70091691 Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Tue, 23 Oct 2018 12:58:16 -0400 Subject: [PATCH] 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. Backports commit ab44c7b71fa683b9402bea0d367b87c881704188 from qemu --- qemu/target/arm/helper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qemu/target/arm/helper.c b/qemu/target/arm/helper.c index 2802a572..8bc31e0b 100644 --- a/qemu/target/arm/helper.c +++ b/qemu/target/arm/helper.c @@ -5655,7 +5655,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 = {0}; bool secure = mmu_idx & ARM_MMU_IDX_M_S; int exc; bool exc_secure; @@ -5713,12 +5713,12 @@ static bool v7m_stack_read(ARMCPU *cpu, uint32_t *dest, uint32_t addr, { CPUState *cs = CPU(cpu); CPUARMState *env = &cpu->env; - MemTxAttrs attrs = {}; + MemTxAttrs attrs = {0}; MemTxResult txres; target_ulong page_size; hwaddr physaddr; int prot; - ARMMMUFaultInfo fi; + ARMMMUFaultInfo fi = {0}; bool secure = mmu_idx & ARM_MMU_IDX_M_S; int exc; bool exc_secure;