Skip to contentSkip to conversation

drm/nouveau: off by one in nouveau_drm_vblank_enable()

PATCH In review Dan Carpenter 3 participants 5 messages Apr 3, 2013 – Sep 27, 2013 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#1 lore raw

PATCH 1/1 drm/nouveau: off by one in nouveau_drm_vblank_enable()

In reply to a message not in the archive

The test here should be ">= ARRAY_SIZE()" instead of "> ARRAY_SIZE()".

---
This was introduced in git://git.freedesktop.org/git/nouveau/linux-2.6 drm-nouveau-fixes-3.9 It hadn't hit linux-next yet yesterday.

drivers/gpu/drm/nouveau/nouveau_drm.c +1 -1
index c95decf..e11f8e4 100644
@@ -86,7 +86,7 @@ nouveau_drm_vblank_enable(struct drm_device *dev, int head)
 	struct nouveau_drm *drm = nouveau_drm(dev);
 	struct nouveau_disp *pdisp = nouveau_disp(drm->device);
 
-	if (WARN_ON_ONCE(head > ARRAY_SIZE(drm->vblank)))
+	if (WARN_ON_ONCE(head >= ARRAY_SIZE(drm->vblank)))
 		return -EIO;
 	WARN_ON_ONCE(drm->vblank[head].func);
 	drm->vblank[head].func = nouveau_drm_vblank_handler;
Acked-by on v1 1/1
#2 lore raw

Op 03-04-13 10:05, Dan Carpenter schreef:

Quoted 3 lines

The test here should be ">= ARRAY_SIZE()" instead of "> ARRAY_SIZE()".

Quoted 18 lines

---
This was introduced in git://git.freedesktop.org/git/nouveau/linux-2.6 drm-nouveau-fixes-3.9 It hadn't hit linux-next yet yesterday.

drivers/gpu/drm/nouveau/nouveau_drm.c +1 -1
index c95decf..e11f8e4 100644
@@ -86,7 +86,7 @@ nouveau_drm_vblank_enable(struct drm_device *dev, int head)
 	struct nouveau_drm *drm = nouveau_drm(dev);
 	struct nouveau_disp *pdisp = nouveau_disp(drm->device);
 
-	if (WARN_ON_ONCE(head > ARRAY_SIZE(drm->vblank)))
+	if (WARN_ON_ONCE(head >= ARRAY_SIZE(drm->vblank)))
 		return -EIO;
 	WARN_ON_ONCE(drm->vblank[head].func);
 	drm->vblank[head].func = nouveau_drm_vblank_handler;
#4 lore raw

PATCH 1/1 drm/nouveau: off by one in nouveau_drm_vblank_enable()

In reply to Maarten Lankhorst

The test here should be ">= ARRAY_SIZE()" instead of "> ARRAY_SIZE()".

---
Somehow this wasn't applied when I sent it earlier.

drivers/gpu/drm/nouveau/nouveau_drm.c +1 -1
index c95decf..e11f8e4 100644
@@ -86,7 +86,7 @@ nouveau_drm_vblank_enable(struct drm_device *dev, int head)
 	struct nouveau_drm *drm = nouveau_drm(dev);
 	struct nouveau_disp *pdisp = nouveau_disp(drm->device);
 
-	if (WARN_ON_ONCE(head > ARRAY_SIZE(drm->vblank)))
+	if (WARN_ON_ONCE(head >= ARRAY_SIZE(drm->vblank)))
 		return -EIO;
 	WARN_ON_ONCE(drm->vblank[head].func);
 	drm->vblank[head].func = nouveau_drm_vblank_handler;
#5 lore raw
Quoted 6 lines · Dan Carpenter

The test here should be ">= ARRAY_SIZE()" instead of "> ARRAY_SIZE()".

---
Somehow this wasn't applied when I sent it earlier.

Sorry about this slipping through the cracks. It's in my tree now, so it'll make it to Dave at some point.

Thanks,
Ben.

Quoted 18 lines
drivers/gpu/drm/nouveau/nouveau_drm.c +1 -1
index c95decf..e11f8e4 100644
@@ -86,7 +86,7 @@ nouveau_drm_vblank_enable(struct drm_device *dev, int head)
        struct nouveau_drm *drm = nouveau_drm(dev);
        struct nouveau_disp *pdisp = nouveau_disp(drm->device);
 
-       if (WARN_ON_ONCE(head > ARRAY_SIZE(drm->vblank)))
+       if (WARN_ON_ONCE(head >= ARRAY_SIZE(drm->vblank)))
                return -EIO;
        WARN_ON_ONCE(drm->vblank[head].func);
        drm->vblank[head].func = nouveau_drm_vblank_handler;

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel