diff mbox

drm/savage: off by one in savage_bci_cmdbuf()

Message ID 20180704094810.whrgn6jxe7uibnfv@kili.mountain (mailing list archive)
State New, archived
Headers show

Commit Message

Dan Carpenter July 4, 2018, 9:48 a.m. UTC
The > should be >= here so that we don't read beyond the end of the
dma->buflist[] array.

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

Comments

Daniel Vetter July 4, 2018, 12:27 p.m. UTC | #1
On Wed, Jul 04, 2018 at 12:48:10PM +0300, Dan Carpenter wrote:
> The > should be >= here so that we don't read beyond the end of the
> dma->buflist[] array.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Uh, another root-hole driver ... Applied, thanks for the patch.
-Daniel

> 
> diff --git a/drivers/gpu/drm/savage/savage_state.c b/drivers/gpu/drm/savage/savage_state.c
> index 2db89bed52e8..7559a820bd43 100644
> --- a/drivers/gpu/drm/savage/savage_state.c
> +++ b/drivers/gpu/drm/savage/savage_state.c
> @@ -971,7 +971,7 @@ int savage_bci_cmdbuf(struct drm_device *dev, void *data, struct drm_file *file_
>  	LOCK_TEST_WITH_RETURN(dev, file_priv);
>  
>  	if (dma && dma->buflist) {
> -		if (cmdbuf->dma_idx > dma->buf_count) {
> +		if (cmdbuf->dma_idx >= dma->buf_count) {
>  			DRM_ERROR
>  			    ("vertex buffer index %u out of range (0-%u)\n",
>  			     cmdbuf->dma_idx, dma->buf_count - 1);
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox

Patch

diff --git a/drivers/gpu/drm/savage/savage_state.c b/drivers/gpu/drm/savage/savage_state.c
index 2db89bed52e8..7559a820bd43 100644
--- a/drivers/gpu/drm/savage/savage_state.c
+++ b/drivers/gpu/drm/savage/savage_state.c
@@ -971,7 +971,7 @@  int savage_bci_cmdbuf(struct drm_device *dev, void *data, struct drm_file *file_
 	LOCK_TEST_WITH_RETURN(dev, file_priv);
 
 	if (dma && dma->buflist) {
-		if (cmdbuf->dma_idx > dma->buf_count) {
+		if (cmdbuf->dma_idx >= dma->buf_count) {
 			DRM_ERROR
 			    ("vertex buffer index %u out of range (0-%u)\n",
 			     cmdbuf->dma_idx, dma->buf_count - 1);