Skip to contentSkip to conversation

dma: pl330: off by one in pl330_probe()

PATCH In review Dan Carpenter 2 participants 2 messages Nov 8, 2013 – Nov 13, 2013

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

PATCH 1/2 dma: pl330: off by one in pl330_probe()

There are only AMBA_NR_IRQS (2) elements in adev->irq[]. This code maybe works if the there is a zero directly after the array.

drivers/dma/pl330.c +1 -1
index 4b2583c..4af4b0c 100644
@@ -2926,7 +2926,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
 
 	amba_set_drvdata(adev, pdmac);
 
-	for (i = 0; i <= AMBA_NR_IRQS; i++) {
+	for (i = 0; i < AMBA_NR_IRQS; i++) {
 		irq = adev->irq[i];
 		if (irq) {
 			ret = devm_request_irq(&adev->dev, irq,
#1 lore raw
Quoted 2 lines · Dan Carpenter

There are only AMBA_NR_IRQS (2) elements in adev->irq[]. This code maybe works if the there is a zero directly after the array.

Applied both

Thanks
~Vinod

Quoted 16 lines
drivers/dma/pl330.c +1 -1
index 4b2583c..4af4b0c 100644
@@ -2926,7 +2926,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
 
 	amba_set_drvdata(adev, pdmac);
 
-	for (i = 0; i <= AMBA_NR_IRQS; i++) {
+	for (i = 0; i < AMBA_NR_IRQS; i++) {
 		irq = adev->irq[i];
 		if (irq) {
 			ret = devm_request_irq(&adev->dev, irq,