]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
dmaengine: ioatdma: fix u16 overflow in reshape
authorAllen Hubbe <Allen.Hubbe@emc.com>
Tue, 11 Aug 2015 08:05:42 +0000 (04:05 -0400)
committerVinod Koul <vinod.koul@intel.com>
Mon, 17 Aug 2015 08:05:58 +0000 (13:35 +0530)
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>
Acked-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
drivers/dma/ioat/dma_v2.c

index 69c7dfcad0235fd7df04ed5753707156a5ec510e..13fbd9d5b5b92039df977c3495fda1e755ab7cd3 100644 (file)
@@ -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;