Signed-off-by: Lei Wen <lei...@marvell.com> --- drivers/mmc/mmc.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 5cc1904..9a50b2f 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -134,6 +134,10 @@ mmc_bwrite(int dev_num, ulong start, lbaint_t blkcnt, const void*src) if (!mmc) return -1; + if (start > mmc->block_dev.lba || (start + blkcnt) > mmc->block_dev.lba) { + printf("\noperation excceed mmc boudary..\n"); + return 0; + } err = mmc_set_blocklen(mmc, mmc->write_bl_len); if (err) { printf("set write bl len failed\n\r"); @@ -236,6 +240,10 @@ static ulong mmc_bread(int dev_num, ulong start, lbaint_t blkcnt, void *dst) if (!mmc) return 0; + if (start > mmc->block_dev.lba || (start + blkcnt) > mmc->block_dev.lba) { + printf("\noperation excceed mmc boudary..\n"); + return 0; + } /* We always do full block reads from the card */ err = mmc_set_blocklen(mmc, mmc->read_bl_len); -- 1.7.0.4 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot