public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i810: off by one in i810_dma_vertex()
@ 2018-07-03 12:30 Dan Carpenter
  2018-07-03 13:01 ` Daniel Vetter
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2018-07-03 12:30 UTC (permalink / raw)
  To: David Airlie; +Cc: kernel-janitors, dri-devel

If vertex->idx = dma->buf_count then we end up reading one element
beyond the end of the dma->buflist[] array.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/gpu/drm/i810/i810_dma.c b/drivers/gpu/drm/i810/i810_dma.c
index 576a417690d4..3b378936f575 100644
--- a/drivers/gpu/drm/i810/i810_dma.c
+++ b/drivers/gpu/drm/i810/i810_dma.c
@@ -934,7 +934,7 @@ static int i810_dma_vertex(struct drm_device *dev, void *data,
 	DRM_DEBUG("idx %d used %d discard %d\n",
 		  vertex->idx, vertex->used, vertex->discard);
 
-	if (vertex->idx < 0 || vertex->idx > dma->buf_count)
+	if (vertex->idx < 0 || vertex->idx >= dma->buf_count)
 		return -EINVAL;
 
 	i810_dma_dispatch_vertex(dev,

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/i810: off by one in i810_dma_vertex()
  2018-07-03 12:30 [PATCH] drm/i810: off by one in i810_dma_vertex() Dan Carpenter
@ 2018-07-03 13:01 ` Daniel Vetter
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Vetter @ 2018-07-03 13:01 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: David Airlie, kernel-janitors, dri-devel

On Tue, Jul 03, 2018 at 03:30:16PM +0300, Dan Carpenter wrote:
> If vertex->idx = dma->buf_count then we end up reading one element
> beyond the end of the dma->buflist[] array.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

This driver is a full-on root hole no matter what, but applied to appease
the checkers :-)

Thanks, Daniel

> 
> diff --git a/drivers/gpu/drm/i810/i810_dma.c b/drivers/gpu/drm/i810/i810_dma.c
> index 576a417690d4..3b378936f575 100644
> --- a/drivers/gpu/drm/i810/i810_dma.c
> +++ b/drivers/gpu/drm/i810/i810_dma.c
> @@ -934,7 +934,7 @@ static int i810_dma_vertex(struct drm_device *dev, void *data,
>  	DRM_DEBUG("idx %d used %d discard %d\n",
>  		  vertex->idx, vertex->used, vertex->discard);
>  
> -	if (vertex->idx < 0 || vertex->idx > dma->buf_count)
> +	if (vertex->idx < 0 || vertex->idx >= dma->buf_count)
>  		return -EINVAL;
>  
>  	i810_dma_dispatch_vertex(dev,
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-07-03 13:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-03 12:30 [PATCH] drm/i810: off by one in i810_dma_vertex() Dan Carpenter
2018-07-03 13:01 ` Daniel Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox