Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit da3888cb authored by John Crispin's avatar John Crispin Committed by David Woodhouse
Browse files

mtd: check for valid pdata inside plat_nand



If plat_nand loads and the platform_data is not properly set it will segfault.

Signed-off-by: default avatarJohn Crispin <blogic@openwrt.org>
Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent b8c4bf26
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -37,6 +37,11 @@ static int __devinit plat_nand_probe(struct platform_device *pdev)
	const char **part_types;
	int err = 0;

	if (!pdata) {
		dev_err(&pdev->dev, "platform_nand_data is missing\n");
		return -EINVAL;
	}

	if (pdata->chip.nr_chips < 1) {
		dev_err(&pdev->dev, "invalid number of chips specified\n");
		return -EINVAL;