]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/gpu/drm/nouveau/nouveau_perf.c
drm/nouveau/pm: Prevent overflow in nouveau_perf_init()
[mv-sheeva.git] / drivers / gpu / drm / nouveau / nouveau_perf.c
index 922fb6b664edda718e2e15f929500a2fe3967d21..ef9dec0e6f8b343c293eb7002560686838731180 100644 (file)
@@ -182,6 +182,11 @@ nouveau_perf_init(struct drm_device *dev)
                entries   = perf[2];
        }
 
+       if (entries > NOUVEAU_PM_MAX_LEVEL) {
+               NV_DEBUG(dev, "perf table has too many entries - buggy vbios?\n");
+               entries = NOUVEAU_PM_MAX_LEVEL;
+       }
+
        entry = perf + headerlen;
        for (i = 0; i < entries; i++) {
                struct nouveau_pm_level *perflvl = &pm->perflvl[pm->nr_perflvl];