From 5484526ac120eb543e5a28610775f04014814d89 Mon Sep 17 00:00:00 2001 From: Allen Hubbe Date: Tue, 11 Aug 2015 04:05:43 -0400 Subject: [PATCH] dmaengine: ioatdma: fix u16 overflow in cleanup If the allocation order is 16, then the u16 count will overflow and wrap to zero when assigned the value 1 << 16. Change the type of 'total_descs' to int, so that it is large enough to store a value equal or greater than 1 << 16. Signed-off-by: Allen Hubbe Acked-by: Dave Jiang Signed-off-by: Vinod Koul --- 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 13fbd9d..0fba93c 100644 --- a/drivers/dma/ioat/dma_v2.c +++ b/drivers/dma/ioat/dma_v2.c @@ -798,7 +798,7 @@ void ioat2_free_chan_resources(struct dma_chan *c) struct ioat_chan_common *chan = &ioat->base; struct ioatdma_device *device = chan->device; struct ioat_ring_ent *desc; - const u16 total_descs = 1 << ioat->alloc_order; + const int total_descs = 1 << ioat->alloc_order; int descs; int i; -- 2.7.4