Skip to contentSkip to conversation

dmaengine: sirf: off by one in of_dma_sirfsoc_xlate()

PATCH Applied Dan Carpenter 3 participants 3 messages Apr 3, 2014 – Apr 16, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dmaengine: sirf: off by one in of_dma_sirfsoc_xlate()

The ">" here should be ">=" or we are one step beyond the end of the sdma->channels[] array.

Fixes 2e041c94628c ('dmaengine: sirf: enable generic dt binding for dma channels')
drivers/dma/sirf-dma.c +1 -1
index a1bd829..03f7820 100644
@@ -666,7 +666,7 @@ static struct dma_chan *of_dma_sirfsoc_xlate(struct of_phandle_args *dma_spec,
 	struct sirfsoc_dma *sdma = ofdma->of_dma_data;
 	unsigned int request = dma_spec->args[0];
 
-	if (request > SIRFSOC_DMA_CHANNELS)
+	if (request >= SIRFSOC_DMA_CHANNELS)
 		return NULL;
 
 	return dma_get_slave_channel(&sdma->channels[request].chan);
Acked-by on v1 1/1
#1 lore raw

2014-04-03 15:29 GMT+08:00 Dan Carpenter <[email protected]>:

Quoted 6 lines

The ">" here should be ">=" or we are one step beyond the end of the sdma->channels[] array.

Fixes 2e041c94628c ('dmaengine: sirf: enable generic dt binding for dma channels')
Quoted 13 lines
drivers/dma/sirf-dma.c +1 -1
index a1bd829..03f7820 100644
@@ -666,7 +666,7 @@ static struct dma_chan *of_dma_sirfsoc_xlate(struct of_phandle_args *dma_spec,
        struct sirfsoc_dma *sdma = ofdma->of_dma_data;
        unsigned int request = dma_spec->args[0];
 
-       if (request > SIRFSOC_DMA_CHANNELS)
+       if (request >= SIRFSOC_DMA_CHANNELS)
                return NULL;
 
        return dma_get_slave_channel(&sdma->channels[request].chan);