From 04f68c1cf174b075645500437058862b9a3ba169 Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Mon, 17 Nov 2014 08:45:02 +0100 Subject: baytrail: fix range check Change-Id: I59d42cd451997e141e02d99a62b84a7a2201eb31 Found-by: Coverity Scan Signed-off-by: Patrick Georgi Reviewed-on: http://review.coreboot.org/7500 Reviewed-by: Edward O'Callaghan Reviewed-by: Paul Menzel Tested-by: build bot (Jenkins) --- src/soc/intel/baytrail/gfx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') 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 #include #include +#include #include #include @@ -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]; -- cgit v1.2.3