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:35:54 +0800
commit4469d0265865670a345b45dc915ed33651c3ba49 (patch)
treefea439ff2097b181924b64768a1a71aea9a7a237
parent47ae91a681765b11ff6f7fe92c872373d317d4ae (diff)
downloadu-boot-imx-4469d0265865670a345b45dc915ed33651c3ba49.zip
u-boot-imx-4469d0265865670a345b45dc915ed33651c3ba49.tar.gz
u-boot-imx-4469d0265865670a345b45dc915ed33651c3ba49.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;
}