Skip to content

Commit 884a3b6

Browse files
geerturichardweinberger
authored andcommitted
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: 3291b52 ("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>
1 parent a15cf34 commit 884a3b6

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/mtd/ubi/eba.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,7 @@ static int try_recover_peb(struct ubi_volume *vol, int pnum, int lnum,
741741
goto out_put;
742742
}
743743

744+
vid_hdr = ubi_get_vid_hdr(vidb);
744745
ubi_assert(vid_hdr->vol_type == UBI_VID_DYNAMIC);
745746

746747
mutex_lock(&ubi->buf_mutex);

0 commit comments

Comments
 (0)