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>
Thu, 19 Sep 2019 07:08:06 +0000 (09:08 +0200)
commitfd7674f398043f34afa70723a874c15c8e9033a2
treefbc36cda2f253fb507ddc02e9c46d87b7308d8f1
parentf15b4d221f45904bd70b66b82be9bde62808068d
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