Found ecc verify bug in nand.c
Ken Offer
koffer at arlut.utexas.edu
Fri Aug 16 17:13:44 EDT 2002
Hi all,
Using the cvs code from August 12th, I found a bug in nand.c
that was causing a page write to fail ecc verify. In nand.c in
the function "nand_write_page" there is a line which reads:
if ((this->data_buf[(oob_config.ecc_pos[i])] !=
ecc_code[i]) && ecc_code[i]) {
This is a compare to see if the ecc has changed. Unfortunately,
data_buf is UNSIGNED char and ecc_code is SIGNED char. When
compiling under gcc 2.95.3 on a powerpc system, the code ends up
comparing two identical bytes and fails because one is
sign-extended (example: comparing 0xc3 becomes "0xc3 ==
0xffffffc3"). I don't know if this makes a difference with the
x86 compiler, but it does under powerpc.
Changing the local array "ecc_code" to type "u_char" resolves
the problem. Verified by running nandtest.
+-----------------------------------------------------------+
| Ken Offer koffer at arlut.utexas.edu ARL:UT |
| Office: 512-835-3859 Fax: 512-835-3259 |
+-----------------------------------------------------------+
More information about the linux-mtd
mailing list