All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ioatdma: fix overflow of u16 in ring_reshape
@ 2015-08-05 13:23 Allen Hubbe
  0 siblings, 0 replies; only message in thread
From: Allen Hubbe @ 2015-08-05 13:23 UTC (permalink / raw)
  To: Dan Williams, Dave Jiang; +Cc: dmaengine, linux-kernel, Allen Hubbe

If the allocation order is 16, then the u16 index will overflow and wrap
to zero instead of being equal or greater than 1 << 16.  The loop
condition will always be true, and the loop will run until all the
memory resources are depleted.

Change the type of index 'i' to u32, so that it is large enough to store
a value equal or greater than 1 << 16.

Signed-off-by: Allen Hubbe <Allen.Hubbe@emc.com>
---
 drivers/dma/ioat/dma_v2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/ioat/dma_v2.c b/drivers/dma/ioat/dma_v2.c
index 69c7dfcad023..13fbd9d5b5b9 100644
--- a/drivers/dma/ioat/dma_v2.c
+++ b/drivers/dma/ioat/dma_v2.c
@@ -588,7 +588,7 @@ bool reshape_ring(struct ioat2_dma_chan *ioat, int order)
 	const u16 active = ioat2_ring_active(ioat);
 	const u32 new_size = 1 << order;
 	struct ioat_ring_ent **ring;
-	u16 i;
+	u32 i;
 
 	if (order > ioat_get_max_alloc_order())
 		return false;
-- 
2.5.0.rc1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-08-05 18:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-05 13:23 [PATCH] ioatdma: fix overflow of u16 in ring_reshape Allen Hubbe

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.