From 64f857aefa3050bbfc1c096b873f5b37644722e0 Mon Sep 17 00:00:00 2001 From: Alice Guo Date: Wed, 30 Oct 2019 21:47:47 +0800 Subject: [PATCH] MLK-22865: nandbcb: fix nandbcb dump command bug caused by MLK-22582 In MLK-22582, write memcmp incorrectly as memcpy. Signed-off-by: Alice Guo (cherry picked from commit 16a073f563a25401f1ec289db1c82dd8dab61601) --- arch/arm/mach-imx/cmd_nandbcb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-imx/cmd_nandbcb.c b/arch/arm/mach-imx/cmd_nandbcb.c index 2bf230b3d1..ed523d041b 100644 --- a/arch/arm/mach-imx/cmd_nandbcb.c +++ b/arch/arm/mach-imx/cmd_nandbcb.c @@ -674,7 +674,7 @@ static int do_nandbcb_dump(int argc, char * const argv[]) continue; } bab_block_table[i] = 0; - if (memcpy(dump_nand_fcb + i, &dump_fill_fcb, sizeof(dump_fill_fcb)) != 0) { + if (memcmp(dump_nand_fcb + i, &dump_fill_fcb, sizeof(dump_fill_fcb)) == 0) { printf("mtd: found FCB%d candidate version %08x @%d:0x%x\n", i, dump_nand_fcb[i].version, i, dump_fcb_off[i]); } else { @@ -686,7 +686,7 @@ static int do_nandbcb_dump(int argc, char * const argv[]) if (mtd_block_isbad(dump_mtd, (loff_t)(dump_mtd->erasesize * i))) continue; - if (memcpy(dump_nand_dbbt + i, &dump_fill_dbbt, sizeof(dump_fill_dbbt)) != 0) { + if (memcmp(dump_nand_dbbt + i, &dump_fill_dbbt, sizeof(dump_fill_dbbt)) == 0) { printf("mtd: DBBT%d found\n", i); printf("mtd: Valid DBBT%d found @%d:0x%x\n", i, i, dump_dbbt_off[i]); -- 2.17.1