diff options
author | Geert Uytterhoeven <geert@linux-m68k.org> | 2018-08-29 14:19:55 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2018-08-31 08:23:30 +0200 |
commit | 1d465dda0bdedfc2a5d26979e3cf0d9c3559d4fe (patch) | |
tree | 2cd6a608e10846ea7716888f3ffb41452ed5403a /drivers/mtd/ubi | |
parent | b810dd20c62f66bf878614071043cee99b0769d0 (diff) | |
download | barebox-1d465dda0bdedfc2a5d26979e3cf0d9c3559d4fe.tar.gz barebox-1d465dda0bdedfc2a5d26979e3cf0d9c3559d4fe.tar.xz |
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>
Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/mtd/ubi')
-rw-r--r-- | drivers/mtd/ubi/eba.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c index 7c0fdefa25..d5b47cc205 100644 --- a/drivers/mtd/ubi/eba.c +++ b/drivers/mtd/ubi/eba.c @@ -652,6 +652,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); memset(ubi->peb_buf + offset, 0xFF, len); |