From f17b2991b311b6e4c93e76a35873a0bcc6a4ef63 Mon Sep 17 00:00:00 2001 From: Richard Genoud Date: Mon, 20 Aug 2012 18:00:13 +0200 Subject: [PATCH] --- yaml --- r: 329071 b: refs/heads/master c: d2f588f9340ed23dfb6cda08b8a1917ef3e8527c h: refs/heads/master i: 329069: f6a1882b0a04e40b8b994ad20ff78fa8a7ca9802 329067: 69f16916ec177775c5225c6114637ded0cffce0e 329063: 310e24262f5250437348d2e8c10decd81a532652 329055: 9ce050983f1988bfb570eaf3c6385f01f4dbfe2d v: v3 --- [refs] | 2 +- trunk/drivers/mtd/ubi/build.c | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index ed61b7973650..5883c2f36fa3 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 256334c3191af9d9e520082db9beb75ff801d86c +refs/heads/master: d2f588f9340ed23dfb6cda08b8a1917ef3e8527c diff --git a/trunk/drivers/mtd/ubi/build.c b/trunk/drivers/mtd/ubi/build.c index 8a4eb7c3e0f4..3700bf77b0b8 100644 --- a/trunk/drivers/mtd/ubi/build.c +++ b/trunk/drivers/mtd/ubi/build.c @@ -49,6 +49,9 @@ /* Maximum number of comma-separated items in the 'mtd=' parameter */ #define MTD_PARAM_MAX_COUNT 2 +/* Maximum value for the number of bad PEBs per 1024 PEBs */ +#define MAX_MTD_UBI_BEB_LIMIT 768 + #ifdef CONFIG_MTD_UBI_MODULE #define ubi_is_module() 1 #else @@ -852,6 +855,12 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, struct ubi_device *ubi; int i, err, ref = 0; + if (max_beb_per1024 < 0 || max_beb_per1024 > MAX_MTD_UBI_BEB_LIMIT) + return -EINVAL; + + if (!max_beb_per1024) + max_beb_per1024 = CONFIG_MTD_UBI_BEB_LIMIT; + /* * Check if we already have the same MTD device attached. *