ar71xx: fix invalid pointer dereference in c60_nand_scan_fixup()
Since Linux 4.6, mtd->priv no longer points to the NAND specific
structure. Under 4.9 it contains NULL, thus using it to access
the fields of the nand_chip structure causes an invalid pointer
dereference.
Update the code to use the mtd_to_nand() helper under 4.9 to obtain
the address of the chip specific data.
Compile tested only.
Fixes: 7bbf4117c6
("ar71xx: Add kernel 4.9 support")
Signed-off-by: Gabor Juhos <juhosg@freemail.hu>
Tested-by: Christian Lamparter <chunkeey@gmail.com>
This commit is contained in:
parent
c13b4ef2c8
commit
2ecc413107
1 changed files with 4 additions and 0 deletions
|
@ -180,7 +180,11 @@ static const struct mtd_ooblayout_ops c60_nand_ecclayout_ops = {
|
||||||
|
|
||||||
static int c60_nand_scan_fixup(struct mtd_info *mtd)
|
static int c60_nand_scan_fixup(struct mtd_info *mtd)
|
||||||
{
|
{
|
||||||
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0)
|
||||||
struct nand_chip *chip = mtd->priv;
|
struct nand_chip *chip = mtd->priv;
|
||||||
|
#else
|
||||||
|
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||||
|
#endif
|
||||||
|
|
||||||
chip->ecc.size = 512;
|
chip->ecc.size = 512;
|
||||||
chip->ecc.strength = 4;
|
chip->ecc.strength = 4;
|
||||||
|
|
Loading…
Reference in a new issue