Skip to contentSkip to conversation

iop-adma: Corrected array overflow in RAID6 Xscale(R) test.

PATCH Superseded Don Morris 2 participants 2 messages Feb 29, 2012 – Mar 1, 2012 dmaengine

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Don Morris

author
#0 lore raw

PATCH 1/1 iop-adma: Corrected array overflow in RAID6 Xscale(R) test.

Reported as: https://bugzilla.kernel.org/show_bug.cgi?id=42677

Test code pq_src array was grown by two elements to correspond with actual usage (IOP_ADMA_NUM_SRC_TEST+2), stack consumption was kept constant by modifying the pq_dest two element array which is only used when pq_src is referenced up to IOP_ADMA_NUM_SRC_TEST elements into the address of the new last two elements of the pq_src array. This is presumed to be the original intent but would be reliant on compilers always having pq_dest contiguous with the final element of pq_src.

---
 drivers/dma/iop-adma.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/dma/iop-adma.c +2 -2
index 04be90b..58173ee 100644
@@ -1271,8 +1271,8 @@ iop_adma_pq_zero_sum_self_test(struct iop_adma_device *device)
 	struct page **pq_hw = &pq[IOP_ADMA_NUM_SRC_TEST+2];
 	/* address conversion buffers (dma_map / page_address) */
 	void *pq_sw[IOP_ADMA_NUM_SRC_TEST+2];
-	dma_addr_t pq_src[IOP_ADMA_NUM_SRC_TEST];
-	dma_addr_t pq_dest[2];
+	dma_addr_t pq_src[IOP_ADMA_NUM_SRC_TEST+2];
+	dma_addr_t *pq_dest = &(pq_src[IOP_ADMA_NUM_SRC_TEST]);
 
 	int i;
 	struct dma_async_tx_descriptor *tx;
Signature · 1 line
1.7.9.111.gf3fb0
#1 lore raw

PATCH 1/1 iop-adma: Corrected array overflow in RAID6 Xscale(R) test.

Hello.

Quoted 9 lines · Don Morris

Reported as: https://bugzilla.kernel.org/show_bug.cgi?id=42677

Test code pq_src array was grown by two elements to correspond with actual usage (IOP_ADMA_NUM_SRC_TEST+2), stack consumption was kept constant by modifying the pq_dest two element array which is only used when pq_src is referenced up to IOP_ADMA_NUM_SRC_TEST elements into the address of the new last two elements of the pq_src array. This is presumed to be the original intent but would be reliant on compilers always having pq_dest contiguous with the final element of pq_src.

Signoff is missing -- the patch can't be applied without it.

Quoted 9 lines
---
  drivers/dma/iop-adma.c |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
drivers/dma/iop-adma.c +0 -0
index 04be90b..58173ee 100644

drivers/dma/iop-adma.c iop_adma_pq_zero_sum_self_test(struct iop_adma_device *device) · line 1275

Quoted 7 lines
drivers/dma/iop-adma.c +2 -2
@@ -1271,8 +1271,8 @@ iop_adma_pq_zero_sum_self_test(struct iop_adma_device *device)
  	struct page **pq_hw =&pq[IOP_ADMA_NUM_SRC_TEST+2];
  	/* address conversion buffers (dma_map / page_address) */
  	void *pq_sw[IOP_ADMA_NUM_SRC_TEST+2];
-	dma_addr_t pq_src[IOP_ADMA_NUM_SRC_TEST];
-	dma_addr_t pq_dest[2];
+	dma_addr_t pq_src[IOP_ADMA_NUM_SRC_TEST+2];
+	dma_addr_t *pq_dest =&(pq_src[IOP_ADMA_NUM_SRC_TEST]);

() not necessary.

WBR, Sergei