From 1e97b44e41fa2ae8607af1cead0b714cf23db76f Mon Sep 17 00:00:00 2001 From: Patrick Rudolph Date: Mon, 26 Jan 2026 07:38:14 +0100 Subject: [PATCH] cpu/intel/microcode: Fix get_microcode_size Ancient microcode update files do not have a total_size field. Add support for such platforms and return 2048 in that case. Change-Id: I952edc12cccf24f396d940bc594d8ef97826a253 Signed-off-by: Patrick Rudolph Reviewed-on: https://review.coreboot.org/c/coreboot/+/90910 Reviewed-by: Naresh Tested-by: build bot (Jenkins) Reviewed-by: Sean Rhodes --- src/cpu/intel/microcode/microcode.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/cpu/intel/microcode/microcode.c b/src/cpu/intel/microcode/microcode.c index b22822641a..7e1e1b0641 100644 --- a/src/cpu/intel/microcode/microcode.c +++ b/src/cpu/intel/microcode/microcode.c @@ -132,7 +132,12 @@ uint32_t get_microcode_rev(const void *microcode) uint32_t get_microcode_size(const void *microcode) { - return ((struct microcode *)microcode)->total_size; + u32 size = ((struct microcode *)microcode)->total_size; + + /* Newer microcode updates include a size field, whereas older + * containers set it at 0 and are exactly 2048 bytes long */ + + return size ? size : 2048; } uint32_t get_microcode_checksum(const void *microcode)