All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2] iop-adma: Corrected array overflow in RAID6 Xscale(R) test.
@ 2012-03-15 18:07 ` Don Morris
  0 siblings, 0 replies; 5+ messages in thread
From: Don Morris @ 2012-03-15 18:07 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel; +Cc: dan.j.williams, vinod.koul, Don Morris

Bug: cppcheck reported overflow in array assignment (for loop walks
0 to IOP_ADMA_NUM_SRC_TEST+2, array size is IOP_ADMA_NUM_SRC_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.

Note: This is a re-send of a request for review from two weeks ago.
Looking for review (or shootdown), adding LKML to list for a wider
audience. Thanks.

Updated per review comments of Sergei Shtylyov <sshtylyov@mvista.com>

Signed-off-by: Don Morris <don.morris@hp.com>
---
 drivers/dma/iop-adma.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/iop-adma.c b/drivers/dma/iop-adma.c
index 04be90b..9b1951d 100644
--- a/drivers/dma/iop-adma.c
+++ b/drivers/dma/iop-adma.c
@@ -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;
-- 
1.7.9.111.gf3fb0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH V2] iop-adma: Corrected array overflow in RAID6 Xscale(R) test.
@ 2012-03-15 18:07 ` Don Morris
  0 siblings, 0 replies; 5+ messages in thread
From: Don Morris @ 2012-03-15 18:07 UTC (permalink / raw)
  To: linux-arm-kernel

Bug: cppcheck reported overflow in array assignment (for loop walks
0 to IOP_ADMA_NUM_SRC_TEST+2, array size is IOP_ADMA_NUM_SRC_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.

Note: This is a re-send of a request for review from two weeks ago.
Looking for review (or shootdown), adding LKML to list for a wider
audience. Thanks.

Updated per review comments of Sergei Shtylyov <sshtylyov@mvista.com>

Signed-off-by: Don Morris <don.morris@hp.com>
---
 drivers/dma/iop-adma.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/iop-adma.c b/drivers/dma/iop-adma.c
index 04be90b..9b1951d 100644
--- a/drivers/dma/iop-adma.c
+++ b/drivers/dma/iop-adma.c
@@ -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;
-- 
1.7.9.111.gf3fb0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH V2] iop-adma: Corrected array overflow in RAID6 Xscale(R) test.
  2012-03-15 18:07 ` Don Morris
@ 2012-03-28  8:30   ` Williams, Dan J
  -1 siblings, 0 replies; 5+ messages in thread
From: Williams, Dan J @ 2012-03-28  8:30 UTC (permalink / raw)
  To: Don Morris; +Cc: linux-arm-kernel, linux-kernel, vinod.koul

On Thu, Mar 15, 2012 at 11:07 AM, Don Morris <don.morris@hp.com> wrote:
> Bug: cppcheck reported overflow in array assignment (for loop walks
> 0 to IOP_ADMA_NUM_SRC_TEST+2, array size is IOP_ADMA_NUM_SRC_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.
>
> Note: This is a re-send of a request for review from two weeks ago.
> Looking for review (or shootdown), adding LKML to list for a wider
> audience. Thanks.
>
> Updated per review comments of Sergei Shtylyov <sshtylyov@mvista.com>
>
> Signed-off-by: Don Morris <don.morris@hp.com>

Applied, thanks, and I'll send it along for Vinod's tree.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH V2] iop-adma: Corrected array overflow in RAID6 Xscale(R) test.
@ 2012-03-28  8:30   ` Williams, Dan J
  0 siblings, 0 replies; 5+ messages in thread
From: Williams, Dan J @ 2012-03-28  8:30 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Mar 15, 2012 at 11:07 AM, Don Morris <don.morris@hp.com> wrote:
> Bug: cppcheck reported overflow in array assignment (for loop walks
> 0 to IOP_ADMA_NUM_SRC_TEST+2, array size is IOP_ADMA_NUM_SRC_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.
>
> Note: This is a re-send of a request for review from two weeks ago.
> Looking for review (or shootdown), adding LKML to list for a wider
> audience. Thanks.
>
> Updated per review comments of Sergei Shtylyov <sshtylyov@mvista.com>
>
> Signed-off-by: Don Morris <don.morris@hp.com>

Applied, thanks, and I'll send it along for Vinod's tree.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH V2] iop-adma: Corrected array overflow in RAID6 Xscale(R) test.
@ 2012-03-01 15:48 Don Morris
  0 siblings, 0 replies; 5+ messages in thread
From: Don Morris @ 2012-03-01 15:48 UTC (permalink / raw)
  To: linux-arm-kernel

Bug: cppcheck reported overflow in array assignment (for loop walks
0 to IOP_ADMA_NUM_SRC_TEST+2, array size is IOP_ADMA_NUM_SRC_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.

Updated per review comments of Sergei Shtylyov <sshtylyov@mvista.com>

Signed-off-by: Don Morris <don.morris@hp.com>
---
 drivers/dma/iop-adma.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/iop-adma.c b/drivers/dma/iop-adma.c
index 04be90b..9b1951d 100644
--- a/drivers/dma/iop-adma.c
+++ b/drivers/dma/iop-adma.c
@@ -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;
-- 
1.7.9.111.gf3fb0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-03-28  8:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-15 18:07 [PATCH V2] iop-adma: Corrected array overflow in RAID6 Xscale(R) test Don Morris
2012-03-15 18:07 ` Don Morris
2012-03-28  8:30 ` Williams, Dan J
2012-03-28  8:30   ` Williams, Dan J
  -- strict thread matches above, loose matches on Subject: below --
2012-03-01 15:48 Don Morris

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.