* [PATCH mtd-utils] nandflipbits: fix corrupted oob
@ 2022-06-16 7:39 Christophe Kerello
2022-06-27 6:03 ` David Oberhollenzer
0 siblings, 1 reply; 2+ messages in thread
From: Christophe Kerello @ 2022-06-16 7:39 UTC (permalink / raw)
To: miquel.raynal, richard, vigneshr
Cc: linux-mtd, linux-kernel, linux-stm32, Christophe Kerello
If a bit is flipped in block 1 or higher, the OOB is corrupted with the
OOB of block 0. Mtd_read_oob API has to take into account the block number
to be able to calculate the right offset.
Fixes: 9fc8db29cf62 ("mtd-utils: Add nandflipbits tool")
Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
---
nand-utils/nandflipbits.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/nand-utils/nandflipbits.c b/nand-utils/nandflipbits.c
index aa6850f..cd66d0b 100644
--- a/nand-utils/nandflipbits.c
+++ b/nand-utils/nandflipbits.c
@@ -249,7 +249,9 @@ int main(int argc, char **argv)
bufoffs += mtd.min_io_size;
- ret = mtd_read_oob(mtd_desc, &mtd, fd, blkoffs,
+ ret = mtd_read_oob(mtd_desc, &mtd, fd,
+ bit_to_flip->block * mtd.eb_size +
+ blkoffs,
mtd.oob_size, buffer + bufoffs);
if (ret) {
fprintf(stderr, "MTD OOB read failure\n");
--
2.25.1
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH mtd-utils] nandflipbits: fix corrupted oob
2022-06-16 7:39 [PATCH mtd-utils] nandflipbits: fix corrupted oob Christophe Kerello
@ 2022-06-27 6:03 ` David Oberhollenzer
0 siblings, 0 replies; 2+ messages in thread
From: David Oberhollenzer @ 2022-06-27 6:03 UTC (permalink / raw)
To: Christophe Kerello, miquel.raynal, richard, vigneshr
Cc: linux-mtd, linux-kernel, linux-stm32
Applied to mtd-utils.git master
Thanks,
David
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-06-27 6:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-16 7:39 [PATCH mtd-utils] nandflipbits: fix corrupted oob Christophe Kerello
2022-06-27 6:03 ` David Oberhollenzer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).