Date:2010-10-25 05:32:24 (3 years 11 months ago)
Author:Xiangfu Liu
Commit:d0d0131a0e570fc521020f685403f7cedb885087
Message:[uboot-xbust] fixed the [src] overflow when it calculate by block-num * blokc-size

Signed-off-by: Xiangfu Liu <xiangfu@sharism.cc>
Files: package/uboot-xburst/files/drivers/mmc/jz_mmc.c (3 diffs)

Change Details

package/uboot-xburst/files/drivers/mmc/jz_mmc.c
558558    if (retval = mmc_unpack_r1(&request, &r1, 0))
559559        goto exit;
560560
561    if (sd2_0)
562        src /= len;
561    if (!sd2_0)
562        src *= mmcinfo.block_len;
563563
564564    mmc_send_cmd(&request, MMC_CMD_READ_SINGLE_BLOCK, src, 1, len, RESPONSE_R1, dst);
565565    if (retval = mmc_unpack_r1(&request, &r1, 0))
...... 
571571
572572ulong mmc_bread(int dev_num, ulong blkstart, ulong blkcnt, ulong *dst)
573573{
574       if (!mmc_ready) {
575               printf("Please initial the MMC first\n");
576               return -1;
577       }
578
579       int i = 0;
580       ulong src = blkstart * mmcinfo.block_len;
581       ulong dst_tmp = dst;
574    if (!mmc_ready) {
575        printf("Please initial the MMC first\n");
576        return -1;
577    }
578
579    int i = 0;
580    ulong dst_tmp = dst;
582581
583       for (i = 0; i < blkcnt; i++) {
584               if ((mmc_block_read((uchar *)(dst_tmp), src, mmcinfo.block_len)) < 0)
582    for (i = 0; i < blkcnt; i++) {
583        if ((mmc_block_read((uchar *)(dst_tmp), blkstart, mmcinfo.block_len)) < 0)
585584            return -1;
586585
587               dst_tmp += mmcinfo.block_len;
588               src += mmcinfo.block_len;
586        dst_tmp += mmcinfo.block_len;
587        blkstart++;
589588    }
590589
591       return i;
590    return i;
592591}
593592
594593int mmc_select_card(void)
...... 
11651164}
11661165
11671166void mmc_send_cmd(struct mmc_request *request, int cmd, u32 arg,
1168           u16 nob, u16 block_len, enum mmc_rsp_t rtype, u8 *buffer)
1167          u16 nob, u16 block_len, enum mmc_rsp_t rtype, u8 *buffer)
11691168{
11701169    request->cmd = cmd;
11711170    request->arg = arg;

Archive Download the corresponding diff file



interactive