dmaengine: ioatdma: fix uninitialized array usage
authorDave Jiang <dave.jiang@intel.com>
Thu, 21 Jul 2016 19:40:52 +0000 (12:40 -0700)
committerVinod Koul <vinod.koul@intel.com>
Mon, 8 Aug 2016 02:32:00 +0000 (08:02 +0530)
commit2eab9b1a3006b4f7bf49c55ce23943170a0068db
tree3fe2a110519635d3ede4a271ad6b9feb48be8cab
parent29b4817d4018df78086157ea3a55c1d9424a7cfc
dmaengine: ioatdma: fix uninitialized array usage

Static analysis showed that unitialized array is being used for compare.
At line 850 when a dma_mapping_error() occurs, it jumps to dma_unmap. At
this point, dma_srcs has not been initialized. However, the code after
dma_unmap label checks dma_srcs for a comparison and thus is comparing
to random garbage in the array. Given that when dest_dma is being mapped
this is the first instance of mapping DMA memory and failed, there is
really nothing to be cleaned up and thus should jump to free_resources
label instead.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
drivers/dma/ioat/init.c