summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Petrov <andrey.petrov@intel.com>2016-07-18 07:59:03 -0700
committerMartin Roth <martinroth@google.com>2016-07-19 18:57:13 +0200
commitdc97b1ce2f4e671e73e2a3fb65e49a881a694590 (patch)
tree62f57cf5b29a7eaa2f2149ffa38473ac3c64831f
parentb921725b52a98970af5786ca58d7e511fe8870dc (diff)
downloadcoreboot-dc97b1ce2f4e671e73e2a3fb65e49a881a694590.tar.xz
soc/intel/apollolake: Fix bitshift issue in bootblock
Fix issue where zero-sized BIOS region could cause bitshift for '-1' which is an unspecified behavior. Change-Id: Icb62bf413a1a0d293657503ef21fe97b5f9a5484 Signed-off-by: Andrey Petrov <andrey.petrov@intel.com> Reviewed-on: https://review.coreboot.org/15727 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin <adurbin@chromium.org>
-rw-r--r--src/soc/intel/apollolake/bootblock/bootblock.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/soc/intel/apollolake/bootblock/bootblock.c b/src/soc/intel/apollolake/bootblock/bootblock.c
index 8c1ff919d1..31144ff219 100644
--- a/src/soc/intel/apollolake/bootblock/bootblock.c
+++ b/src/soc/intel/apollolake/bootblock/bootblock.c
@@ -98,7 +98,10 @@ static void cache_bios_region(void)
return;
/* Only the IFD BIOS region is memory mapped (at top of 4G) */
- rom_size = get_bios_size();
+ rom_size = get_bios_size();
+
+ if (!rom_size)
+ return;
/* Round to power of two */
alignment = 1 << (log2_ceil(rom_size));