John Zhao has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/32924
Change subject: soc/intel/common: Add negative sign check for variable bios_size ......................................................................
soc/intel/common: Add negative sign check for variable bios_size
Clang Static Analyzer found that the rounding operation of alignment=1UL<<(log2_ceil(bios_size)) is garbage or undefined if varialbe bios_size is negative. Add sanity check for bios_size to prevent rounding error.
Signed-off-by: John Zhao john.zhao@intel.com Change-Id: Ifc3f3da52d129ef5d6063a46b045603a236be759 --- M src/soc/intel/common/block/fast_spi/fast_spi.c 1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/24/32924/1
diff --git a/src/soc/intel/common/block/fast_spi/fast_spi.c b/src/soc/intel/common/block/fast_spi/fast_spi.c index 455b13c..560c75c 100644 --- a/src/soc/intel/common/block/fast_spi/fast_spi.c +++ b/src/soc/intel/common/block/fast_spi/fast_spi.c @@ -236,7 +236,7 @@ /* Only the IFD BIOS region is memory mapped (at top of 4G) */ fast_spi_get_bios_region(&bios_size);
- if (!bios_size) + if (!bios_size || (bios_size < 0)) return;
/* LOCAL APIC default address is 0xFEE0000, bios_size over 16MB will