UBI: account for bitflips in both the VID header and data
authorBrian Norris <computersforpeace@gmail.com>
Sat, 28 Feb 2015 10:23:25 +0000 (02:23 -0800)
committerBen Hutchings <ben@decadent.org.uk>
Thu, 6 Aug 2015 23:32:01 +0000 (00:32 +0100)
commit 8eef7d70f7c6772c3490f410ee2bceab3b543fa1 upstream.

We are completely discarding the earlier value of 'bitflips', which
could reflect a bitflip found in ubi_io_read_vid_hdr(). Let's use the
bitwise OR of header and data 'bitflip' statuses instead.

Coverity CID #1226856

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
[bwh: Backported to 3.2: adjust filename]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/mtd/ubi/scan.c

index b2b62de..c5b2357 100644 (file)
@@ -408,7 +408,7 @@ static int compare_lebs(struct ubi_device *ubi, const struct ubi_scan_leb *seb,
                second_is_newer = !second_is_newer;
        } else {
                dbg_bld("PEB %d CRC is OK", pnum);
-               bitflips = !!err;
+               bitflips |= !!err;
        }
 
        vfree(buf);