diff --git a/src/arch/x86/acpi_bert_storage.c b/src/arch/x86/acpi_bert_storage.c index e9b9fc563a..321f66ac54 100644 --- a/src/arch/x86/acpi_bert_storage.c +++ b/src/arch/x86/acpi_bert_storage.c @@ -550,8 +550,6 @@ cper_ia32x64_context_t *cper_new_ia32x64_context_msr( cper_ia32x64_proc_error_section_t *x86err, u32 addr, int num) { cper_ia32x64_context_t *ctx; - int i; - msr_t *dest; ctx = new_cper_ia32x64_ctx(status, x86err, CPER_IA32X64_CTX_MSR, num * sizeof(msr_t)); if (!ctx) @@ -564,9 +562,9 @@ cper_ia32x64_context_t *cper_new_ia32x64_context_msr( */ ctx->msr_addr = addr; - dest = (msr_t *)((u8 *)(ctx + 1)); /* point to the Register Array */ + msr_t *dest = (msr_t *)(ctx->register_array); /* point to the Register Array */ - for (i = 0 ; i < num ; i++) + for (int i = 0 ; i < num ; i++) *(dest + i) = rdmsr(addr + i); return ctx; } diff --git a/src/include/cper.h b/src/include/cper.h index d0f7b30581..4dec2a2247 100644 --- a/src/include/cper.h +++ b/src/include/cper.h @@ -289,7 +289,7 @@ typedef struct cper_ia32x64_context { u16 array_size; u32 msr_addr; u64 mmap_addr; - /* N bytes of register array */ + u8 register_array[]; /* N bytes of register array */ } __packed cper_ia32x64_context_t; /* IA32/X64 Processor Context Information, Types field (Table N.13) */