mtd: rawnand: mtk: Fix wrongly assigned OOB buffer pointer issue
authorXiaolei Li <xiaolei.li@mediatek.com>
Tue, 7 May 2019 10:25:41 +0000 (18:25 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 21 Sep 2019 05:14:06 +0000 (07:14 +0200)
commita29928adcc75b18cfa24f1280c2d42c61f3087b8
treece0245d459801d37bfffe299a75e2400a5ab3122
parentd8f45c1ef20a6d78f1bdc55dfa0c80a5a9217074
mtd: rawnand: mtk: Fix wrongly assigned OOB buffer pointer issue

commit 336d4b138be2dad372b67a2388e42805c48aaa38 upstream.

One main goal of the function mtk_nfc_update_ecc_stats is to check
whether sectors are all empty. If they are empty, set these sectors's
data buffer and OOB buffer as 0xff.

But now, the sector OOB buffer pointer is wrongly assigned. We always
do memset from sector 0.

To fix this issue, pass start sector number to make OOB buffer pointer
be properly assigned.

Fixes: 1d6b1e464950 ("mtd: mediatek: driver for MTK Smart Device")
Signed-off-by: Xiaolei Li <xiaolei.li@mediatek.com>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mtd/nand/mtk_nand.c