soc/intel/baytrail: Correct array bounds check

If `gms == ARRAY_SIZE(gms_size_map)`, then we will have an
out of bounds read. Fix the check to exclude this case.
This was partially fixed in 04f68c1 (baytrail: fix range
check).

Found-by: Coverity Scan, CID 1229677 (OVERRUN)
Signed-off-by: Jacob Garber <jgarber1@ualberta.ca>
Change-Id: I8c8cd59df49beea066b46cde3cf00237816aff33
Reviewed-on: https://review.coreboot.org/c/coreboot/+/32125
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
This commit is contained in:
Jacob Garber 2019-03-29 18:33:32 -06:00 committed by Patrick Georgi
parent 42660cdda7
commit 0decccb666
1 changed files with 1 additions and 1 deletions

View File

@ -48,7 +48,7 @@ static void gfx_lock_pcbase(struct device *dev)
gms = pci_read_config32(dev, GGC) & GGC_GSM_SIZE_MASK; gms = pci_read_config32(dev, GGC) & GGC_GSM_SIZE_MASK;
gms >>= 3; gms >>= 3;
if (gms > ARRAY_SIZE(gms_size_map)) if (gms >= ARRAY_SIZE(gms_size_map))
return; return;
gmsize = gms_size_map[gms]; gmsize = gms_size_map[gms];