Commit 4469d0265865670a345b45dc915ed33651c3ba49

Authored by Han Xu
Committed by guoyin.chen
1 parent 47ae91a681

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>

Showing 1 changed file with 2 additions and 2 deletions Side-by-side Diff

drivers/mtd/nand/mxs_nand.c
... ... @@ -1210,10 +1210,10 @@
1210 1210 for (--j; j >= 0; j--)
1211 1211 mxs_dma_release(j);
1212 1212 err2:
1213   - free(info->desc);
1214   -err1:
1215 1213 for (--i; i >= 0; i--)
1216 1214 mxs_dma_desc_free(info->desc[i]);
  1215 + free(info->desc);
  1216 +err1:
1217 1217 printf("MXS NAND: Unable to allocate DMA descriptors\n");
1218 1218 return -ENOMEM;
1219 1219 }