]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
UBI: fastmap: do not miss bit-flips
authorBrian Norris <computersforpeace@gmail.com>
Wed, 21 May 2014 05:35:38 +0000 (22:35 -0700)
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Wed, 16 Jul 2014 05:32:00 +0000 (08:32 +0300)
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>
drivers/mtd/ubi/fastmap.c

index 72f39daee649e9bccd0597d96cb001515f89ec63..0431b46d9fd9e0211a8c7f5e865721a6b32895b5 100644 (file)
@@ -423,7 +423,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;
 
                /*