diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2017-03-14 08:08:36 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2017-03-30 08:23:21 +0200 |
commit | a8ef43b995fcd4c92edbf9492ac0378f8dc2441a (patch) | |
tree | 515d0c94bf8c60510ab8150460c44e497ccbcd7c /commands/nand-bitflip.c | |
parent | 822a04f43c5286cb1127a6d94b4a4dd147396a5e (diff) | |
download | barebox-a8ef43b995fcd4c92edbf9492ac0378f8dc2441a.tar.gz barebox-a8ef43b995fcd4c92edbf9492ac0378f8dc2441a.tar.xz |
mtd: when creating bitflips the offset has to be page aligned
mtd_peb_create_bitflips() assumes the offset is page aligned. Enforce
this and in the nand_bitlfip command print a warning if it's not
aligned.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands/nand-bitflip.c')
-rw-r--r-- | commands/nand-bitflip.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/commands/nand-bitflip.c b/commands/nand-bitflip.c index fe56f222cf..a8a97c153a 100644 --- a/commands/nand-bitflip.c +++ b/commands/nand-bitflip.c @@ -69,6 +69,10 @@ static int do_nand_bitflip(int argc, char *argv[]) block += mtd_div_by_eb(offset, meminfo.mtd); offset = mtd_mod_by_eb(offset, meminfo.mtd); + if ((int)offset % meminfo.mtd->writesize) { + printf("offset has to be pagesize aligned\n"); + return 1; + } if (!check) { ret = mtd_peb_create_bitflips(meminfo.mtd, block, offset, meminfo.writesize, |