Skip to content

Commit d6a2d02

Browse files
PatrickRudolphardbiesheuvel
authored andcommitted
efi/cper: Fix cper_arm_ctx_info alignment
According to the UEFI Common Platform Error Record appendix, the processor context information structure is a variable length structure, but "is padded with zeros if the size is not a multiple of 16 bytes". Currently this isn't honoured, causing all but the first structure to be garbage when printed. Thus align the size to be a multiple of 16. Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
1 parent 174e5e9 commit d6a2d02

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/firmware/efi/cper-arm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ void cper_print_proc_arm(const char *pfx,
311311
ctx_info = (struct cper_arm_ctx_info *)err_info;
312312
max_ctx_type = ARRAY_SIZE(arm_reg_ctx_strs) - 1;
313313
for (i = 0; i < proc->context_info_num; i++) {
314-
int size = sizeof(*ctx_info) + ctx_info->size;
314+
int size = ALIGN(sizeof(*ctx_info) + ctx_info->size, 16);
315315

316316
printk("%sContext info structure %d:\n", pfx, i);
317317
if (len < size) {

0 commit comments

Comments
 (0)