Martin Roth has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32924 )
Change subject: soc/intel/common: Add negative sign check for variable bios_size ......................................................................
Patch Set 2:
(1 comment)
https://review.coreboot.org/#/c/32924/2/src/soc/intel/common/block/fast_spi/... File src/soc/intel/common/block/fast_spi/fast_spi.c:
https://review.coreboot.org/#/c/32924/2/src/soc/intel/common/block/fast_spi/... PS2, Line 249: It's actually not bios_size that's causing the issue, but log2_ceil itself. If bios_size is 0, log2_ceil returns -1. I think that's where the error comes from, not from bios_size being <0 which as stated doesn't make sense. We've already checked to make sure that bios size isn't 0 above, but then we set bios_size again with MIN() I think that's what's confusing the compiler. Let's just move the if (!bios_size) below the MIN() - I bet that will take care of it.
/* LOCAL APIC default address is 0xFEE0000, bios_size over 16MB will * cause memory type conflict when setting memory type to write * protection, so limit the cached bios region to be no more than 16MB. * */ bios_size = MIN(bios_size, 16 * MiB);
if (!bios_size) return;
/* Round to power of two */ alignment = 1UL << (log2_ceil(bios_size));