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)
committerSasha Levin <sasha.levin@oracle.com>
Sun, 17 May 2015 23:12:10 +0000 (19:12 -0400)
[ Upstream commit 8eef7d70f7c6772c3490f410ee2bceab3b543fa1 ]

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

Cc: stable <stable@vger.kernel.org>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
drivers/mtd/ubi/attach.c

index 6f27d9a..21841fe 100644 (file)
@@ -408,7 +408,7 @@ int ubi_compare_lebs(struct ubi_device *ubi, const struct ubi_ainf_peb *aeb,
                second_is_newer = !second_is_newer;
        } else {
                dbg_bld("PEB %d CRC is OK", pnum);
-               bitflips = !!err;
+               bitflips |= !!err;
        }
        mutex_unlock(&ubi->buf_mutex);