summaryrefslogtreecommitdiff
path: root/src/soc
diff options
context:
space:
mode:
authorPatrick Georgi <patrick@georgi-clan.de>2014-11-17 08:45:02 +0100
committerPatrick Georgi <pgeorgi@google.com>2014-11-18 08:25:43 +0100
commit04f68c1cf174b075645500437058862b9a3ba169 (patch)
tree697b3215a27f649e86c4a4789eca852f7c18d9b0 /src/soc
parenta0158125e1533b8985c6326213af148e4f21fa0b (diff)
downloadcoreboot-04f68c1cf174b075645500437058862b9a3ba169.tar.xz
baytrail: fix range check
Change-Id: I59d42cd451997e141e02d99a62b84a7a2201eb31 Found-by: Coverity Scan Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: http://review.coreboot.org/7500 Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Tested-by: build bot (Jenkins)
Diffstat (limited to 'src/soc')
-rw-r--r--src/soc/intel/baytrail/gfx.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/soc/intel/baytrail/gfx.c b/src/soc/intel/baytrail/gfx.c
index 9d4768f65a..5650d0d1f9 100644
--- a/src/soc/intel/baytrail/gfx.c
+++ b/src/soc/intel/baytrail/gfx.c
@@ -24,6 +24,7 @@
#include <device/pci.h>
#include <device/pci_ids.h>
#include <reg_script.h>
+#include <stdlib.h>
#include <baytrail/gfx.h>
#include <baytrail/iosf.h>
@@ -49,7 +50,7 @@ static void gfx_lock_pcbase(device_t dev)
gms = pci_read_config32(dev, GGC) & GGC_GSM_SIZE_MASK;
gms >>= 3;
- if (gms > sizeof(gms_size_map))
+ if (gms > ARRAY_SIZE(gms_size_map))
return;
gmsize = gms_size_map[gms];