soc/intel/common: Check bios_size and window_size after MIN operation
commit2bb432ece634af05aade44ea55755ae3e6637acf
authorJohn Zhao <john.zhao@intel.com>
Wed, 22 May 2019 02:32:51 +0000 (21 19:32 -0700)
committerPatrick Georgi <pgeorgi@google.com>
Wed, 29 May 2019 20:08:04 +0000 (29 20:08 +0000)
treea1391ea84010f27292d4230d12f98e9a4a4b2734
parent64fb5aa9c3e50a49d2ecc153ff8c597e203475bc
soc/intel/common: Check bios_size and window_size after MIN operation

Clang Static Analyzer version 8.0.0 detects that log2_ceil(bios_size)
and log2_ceil(window_size) are garbage or undefined if the value of
bios_size and window_size is zero. Check bios_size and window_size after
MIN operation to prevent error.

TEST=Built and boot up to kernel.

Change-Id: Ifc3f3da52d129ef5d6063a46b045603a236be759
Signed-off-by: John Zhao <john.zhao@intel.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/32924
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
src/soc/intel/common/block/fast_spi/fast_spi.c
src/soc/intel/common/block/lpc/lpc_lib.c