summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Norris <computersforpeace@gmail.com>2014-05-20 22:35:38 -0700
committerSascha Hauer <s.hauer@pengutronix.de>2014-09-11 15:53:27 +0200
commit305b1bbea903d25cf80826208d56e620db6378c0 (patch)
tree2240e21cf27d01368eadda7a105c07a7db74c858
parent6dbc4e658cb9f4a980022a0e152c5ec4c023e8d9 (diff)
downloadbarebox-305b1bbea903d25cf80826208d56e620db6378c0.tar.gz
barebox-305b1bbea903d25cf80826208d56e620db6378c0.tar.xz
UBI: fastmap: do not miss bit-flips
The return value from 'ubi_io_read_ec_hdr()' was stored in 'err', not in 'ret'. This fix makes sure Fastmap-enabled UBI does not miss bit-flip while reading EC headers, events and scrubs the affected PEBs. This issue was reported by Coverity Scan. Artem: improved the commit message. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Acked-by: Richard Weinberger <richard@nod.at> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
-rw-r--r--drivers/mtd/ubi/fastmap.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c
index 21b7f076b..8f29430e5 100644
--- a/drivers/mtd/ubi/fastmap.c
+++ b/drivers/mtd/ubi/fastmap.c
@@ -422,7 +422,7 @@ static int scan_pool(struct ubi_device *ubi, struct ubi_attach_info *ai,
pnum, err);
ret = err > 0 ? UBI_BAD_FASTMAP : err;
goto out;
- } else if (ret == UBI_IO_BITFLIPS)
+ } else if (err == UBI_IO_BITFLIPS)
scrub = 1;
/*