diff mbox

drm/nouveau: off by one in nouveau_drm_vblank_enable()

Message ID 20130403080538.GA11225@longonot.mountain (mailing list archive)
State New, archived
Headers show

Commit Message

Dan Carpenter April 3, 2013, 8:05 a.m. UTC
The test here should be ">= ARRAY_SIZE()" instead of "> ARRAY_SIZE()".

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
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.

Comments

Maarten Lankhorst April 3, 2013, 11:33 a.m. UTC | #1
Op 03-04-13 10:05, Dan Carpenter schreef:
> The test here should be ">= ARRAY_SIZE()" instead of "> ARRAY_SIZE()".
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
> ---
> 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.
>
> diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
> index c95decf..e11f8e4 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_drm.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
> @@ -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;
>
Dan Carpenter June 21, 2013, 11:47 a.m. UTC | #2
On Wed, Apr 03, 2013 at 01:33:09PM +0200, Maarten Lankhorst wrote:
> Op 03-04-13 10:05, Dan Carpenter schreef:
> > The test here should be ">= ARRAY_SIZE()" instead of "> ARRAY_SIZE()".
> >
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> Acked-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>

We still need this patch in linux-next.

regards,
dan carpenter
diff mbox

Patch

diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index c95decf..e11f8e4 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -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;