[074/114] gen_nand: Test if nr_chips field is valid

From: Greg KH
Date: Tue Aug 24 2010 - 19:11:59 EST


2.6.35-stable review patch. If anyone has any objections, please let us know.

------------------

From: Marek Vasut <marek.vasut@xxxxxxxxx>

commit 01cd2ababddd55a127caa1cd20d570637e0d42e1 upstream.

Signed-off-by: Marek Vasut <marek.vasut@xxxxxxxxx>
Signed-off-by: David Woodhouse <David.Woodhouse@xxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>

---
drivers/mtd/nand/plat_nand.c | 5 +++++
1 file changed, 5 insertions(+)

--- a/drivers/mtd/nand/plat_nand.c
+++ b/drivers/mtd/nand/plat_nand.c
@@ -37,6 +37,11 @@ static int __devinit plat_nand_probe(str
struct resource *res;
int err = 0;

+ if (pdata->chip.nr_chips < 1) {
+ dev_err(&pdev->dev, "invalid number of chips specified\n");
+ return -EINVAL;
+ }
+
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res)
return -ENXIO;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/