summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert@linux-m68k.org>2016-10-13 16:05:36 +0200
committerRichard Weinberger <richard@nod.at>2016-10-20 00:06:06 +0200
commit884a3b647809cb31cf6bd948f814e93753b38502 (patch)
tree1cc3f6042d9626a668b3f4658ec405c6c540b6eb /drivers/mtd/ubi
parenta15cf34fed779d3d49d76e3a7e63bd0132b6a458 (diff)
downloadlinux-884a3b647809cb31cf6bd948f814e93753b38502.tar.gz
linux-884a3b647809cb31cf6bd948f814e93753b38502.tar.bz2
linux-884a3b647809cb31cf6bd948f814e93753b38502.zip
UBI: Fix crash in try_recover_peb()
drivers/mtd/ubi/eba.c: In function ‘try_recover_peb’: drivers/mtd/ubi/eba.c:744: warning: ‘vid_hdr’ is used uninitialized in this function The pointer vid_hdr is indeed not initialized, leading to a crash when it is dereferenced. Fix this by obtaining the pointer from the VID buffer, like is done everywhere else. Fixes: 3291b52f9ff0acc8 ("UBI: introduce the VID buffer concept") Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'drivers/mtd/ubi')
-rw-r--r--drivers/mtd/ubi/eba.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c
index 95c4048a371e..388e46be6ad9 100644
--- a/drivers/mtd/ubi/eba.c
+++ b/drivers/mtd/ubi/eba.c
@@ -741,6 +741,7 @@ static int try_recover_peb(struct ubi_volume *vol, int pnum, int lnum,
goto out_put;
}
+ vid_hdr = ubi_get_vid_hdr(vidb);
ubi_assert(vid_hdr->vol_type == UBI_VID_DYNAMIC);
mutex_lock(&ubi->buf_mutex);