summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHan Xu <han.xu@nxp.com>2016-01-12 10:41:33 -0600
committerguoyin.chen <guoyin.chen@freescale.com>2016-03-04 15:53:38 +0800
commit8f6f4bd1baf57ad32673ca2f69d2f8baa5a8bc8f (patch)
treefea439ff2097b181924b64768a1a71aea9a7a237
parentad500dbddef6b78383eead2587a08e4b50403358 (diff)
downloadu-boot-imx-8f6f4bd1baf57ad32673ca2f69d2f8baa5a8bc8f.zip
u-boot-imx-8f6f4bd1baf57ad32673ca2f69d2f8baa5a8bc8f.tar.gz
u-boot-imx-8f6f4bd1baf57ad32673ca2f69d2f8baa5a8bc8f.tar.bz2
MLK-12246: mtd: nand: fix the read from pointer after free issue
Fix a read from pointer after free issue in nand error handling path, which was found by coverity. Signed-off-by: Han Xu <han.xu@nxp.com>
-rw-r--r--drivers/mtd/nand/mxs_nand.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mtd/nand/mxs_nand.c b/drivers/mtd/nand/mxs_nand.c
index 7f6351f..3b55ac2 100644
--- a/drivers/mtd/nand/mxs_nand.c
+++ b/drivers/mtd/nand/mxs_nand.c
@@ -1210,10 +1210,10 @@ err3:
for (--j; j >= 0; j--)
mxs_dma_release(j);
err2:
- free(info->desc);
-err1:
for (--i; i >= 0; i--)
mxs_dma_desc_free(info->desc[i]);
+ free(info->desc);
+err1:
printf("MXS NAND: Unable to allocate DMA descriptors\n");
return -ENOMEM;
}