When data is written to NAND Flash, an ECC is computed and stored along side the data (typically in the OOB area).
www.stlinux.com