summaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-01-22 11:38:15 +0100
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-01-25 15:41:25 +0100
commit64203195edf44601d9825284101dcaf7ad54ece8 (patch)
tree9db30aa5b9dca3e04a8c593005d1aee0d001a5cb /drivers/mtd
parentUBI: remove bogus assertion (diff)
downloadlinux-64203195edf44601d9825284101dcaf7ad54ece8.tar.xz
linux-64203195edf44601d9825284101dcaf7ad54ece8.zip
UBI: add sanity check
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/ubi/scan.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/mtd/ubi/scan.c b/drivers/mtd/ubi/scan.c
index 0c05f7b90127..e47663870501 100644
--- a/drivers/mtd/ubi/scan.c
+++ b/drivers/mtd/ubi/scan.c
@@ -286,9 +286,14 @@ static int compare_lebs(struct ubi_device *ubi, const struct ubi_scan_leb *seb,
* FIXME: but this is anyway obsolete and will be removed at
* some point.
*/
-
dbg_bld("using old crappy leb_ver stuff");
+ if (v1 == v2) {
+ ubi_err("PEB %d and PEB %d have the same version %lld",
+ seb->pnum, pnum, v1);
+ return -EINVAL;
+ }
+
abs = v1 - v2;
if (abs < 0)
abs = -abs;