mtd-tests: nandbiterrs: Fix issue that just insert error at bit 7
Subsystems (2)
PATCH 1/1 mtd-tests: nandbiterrs: Fix issue that just insert error at bit 7
From: Xiaolei Li <xiaolei.li-NuS5LvNUpcJWk0Htik3J/[email protected]>
The function insert_biterror should be designed to insert error at the first '1' bit starting at offset byte.
But now, only bit 7 of each byte is checked, because checking mask is always 0x80.
So, do right shift for checking mask after each checking to check the whole 8 bits of each bytes.
--- tests/mtd-tests/nandbiterrs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/mtd-tests/nandbiterrs.c +1 -1
@@ -333,7 +333,7 @@ static int insert_biterror(void)int bit, mask, byte;for (byte =0 ; byte < pagesize; ++byte) { -for (bit =7 , mask =0x80 ; bit >=0 ; bit--, mask>>=0 ) { +for (bit =7 , mask =0x80 ; bit >=0 ; bit--, mask >>=1 ) {if (wbuffer[byte] & mask) { wbuffer[byte] &= ~mask;printf ("Inserted biterror @ %u/%u\n" , byte, bit);
Signature · 1 line
2.18.0
A message that is not in the archive (sent off-list or not yet received): 20190429032834.7550-1-xiaolei.li-NuS5LvNUpcJWk0Htik3J/[email protected]
David Oberhollenzer
AppliedApplied to mtd-utils.git master.
Thanks,
David