Skip to contentSkip to conversation

S3C24XX: DMA: Use valid index when accessing array

PATCH New Ramax Lo 2 participants 2 messages Dec 8, 2009

Subsystems (2)
lore
Share & tools
lore

Ramax Lo

author
#0 lore raw

PATCH 1/1 S3C24XX: DMA: Use valid index when accessing array

The DMA_CH_VALID bit used in the channel index should be masked out before using it to access the channel array.

---
 arch/arm/plat-s3c24xx/dma.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
arch/arm/plat-s3c24xx/dma.c +4 -2
index f046f8c..3623b2e 100644
@@ -1403,11 +1403,13 @@ static struct s3c2410_dma_chan *s3c2410_dma_map_channel(int channel)
 		ord = &dma_order->channels[channel];
 
 		for (ch = 0; ch < dma_channels; ch++) {
+			int tmp;
 			if (!is_channel_valid(ord->list[ch]))
 				continue;
 
-			if (s3c2410_chans[ord->list[ch]].in_use == 0) {
-				ch = ord->list[ch] & ~DMA_CH_VALID;
+			tmp = ord->list[ch] & ~DMA_CH_VALID;
+			if (s3c2410_chans[tmp].in_use == 0) {
+				ch = tmp;
 				goto found;
 			}
 		}
Signature · 1 line
1.5.4.3
#1 lore raw

PATCH 1/1 S3C24XX: DMA: Use valid index when accessing array

Quoted 2 lines · Ramax Lo

The DMA_CH_VALID bit used in the channel index should be masked out before using it to access the channel array.

ok, applied to s3c24xx-updates.

Quoted 33 lines
---
 arch/arm/plat-s3c24xx/dma.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
arch/arm/plat-s3c24xx/dma.c +4 -2
index f046f8c..3623b2e 100644
@@ -1403,11 +1403,13 @@ static struct s3c2410_dma_chan *s3c2410_dma_map_channel(int channel)
 		ord = &dma_order->channels[channel];
 
 		for (ch = 0; ch < dma_channels; ch++) {
+			int tmp;
 			if (!is_channel_valid(ord->list[ch]))
 				continue;
 
-			if (s3c2410_chans[ord->list[ch]].in_use == 0) {
-				ch = ord->list[ch] & ~DMA_CH_VALID;
+			tmp = ord->list[ch] & ~DMA_CH_VALID;
+			if (s3c2410_chans[tmp].in_use == 0) {
+				ch = tmp;
 				goto found;
 			}
 		}
Signature · 7 lines
1.5.4.3


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Signature · 5 lines
-- 
Ben

Q:      What's a light-year?
A:      One-third less calories than a regular year.