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)
This commit is contained in:
Patrick Georgi 2014-11-17 08:45:02 +01:00 committed by Patrick Georgi
parent a0158125e1
commit 04f68c1cf1
1 changed files with 2 additions and 1 deletions

View File

@ -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];