Skip to content

Commit

Permalink
UBIFS: check return code of ubifs_lpt_lookup
Browse files Browse the repository at this point in the history
Function ubifs_lpt_lookup may return ERR_PTR(...). Check for it.

[Tweaked by Artem Bityutskiy]

Signed-off-by: Vasiliy Kulikov <segooon@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
  • Loading branch information
Vasiliy Kulikov authored and Artem Bityutskiy committed Sep 7, 2010
1 parent 3a8fa0e commit 0e54c89
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion fs/ubifs/lpt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1363,14 +1363,19 @@ static int read_lsave(struct ubifs_info *c)
goto out;
for (i = 0; i < c->lsave_cnt; i++) {
int lnum = c->lsave[i];
struct ubifs_lprops *lprops;

/*
* Due to automatic resizing, the values in the lsave table
* could be beyond the volume size - just ignore them.
*/
if (lnum >= c->leb_cnt)
continue;
ubifs_lpt_lookup(c, lnum);
lprops = ubifs_lpt_lookup(c, lnum);
if (IS_ERR(lprops)) {
err = PTR_ERR(lprops);
goto out;
}
}
out:
vfree(buf);
Expand Down

0 comments on commit 0e54c89

Please sign in to comment.