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:
parent
a0158125e1
commit
04f68c1cf1
|
@ -24,6 +24,7 @@
|
||||||
#include <device/pci.h>
|
#include <device/pci.h>
|
||||||
#include <device/pci_ids.h>
|
#include <device/pci_ids.h>
|
||||||
#include <reg_script.h>
|
#include <reg_script.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <baytrail/gfx.h>
|
#include <baytrail/gfx.h>
|
||||||
#include <baytrail/iosf.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 = pci_read_config32(dev, GGC) & GGC_GSM_SIZE_MASK;
|
||||||
gms >>= 3;
|
gms >>= 3;
|
||||||
if (gms > sizeof(gms_size_map))
|
if (gms > ARRAY_SIZE(gms_size_map))
|
||||||
return;
|
return;
|
||||||
gmsize = gms_size_map[gms];
|
gmsize = gms_size_map[gms];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue