UBIFS: check return code of ubifs_lpt_lookup
authorVasiliy Kulikov <segooon@gmail.com>
Sun, 5 Sep 2010 18:33:00 +0000 (22:33 +0400)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Tue, 7 Sep 2010 09:09:41 +0000 (12:09 +0300)
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>
fs/ubifs/lpt.c

index 0084a33c4c69bba01e8a264bf7a6576ddede3744..72775d35b99e55308b1ad963cc9c13487b5412fc 100644 (file)
@@ -1363,6 +1363,7 @@ 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
@@ -1370,7 +1371,11 @@ static int read_lsave(struct ubifs_info *c)
                 */
                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);