Skip to content

Commit

Permalink
UBIFS: fix return code
Browse files Browse the repository at this point in the history
Fix to return -ENOMEM in the kmalloc() and d_make_root() error handling
case instead of 0, as done elsewhere in those functions.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
  • Loading branch information
Wei Yongjun authored and Artem Bityutskiy committed Oct 26, 2013
1 parent e71d1a5 commit 7203db9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions fs/ubifs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -1629,8 +1629,10 @@ static int ubifs_remount_rw(struct ubifs_info *c)
}

c->write_reserve_buf = kmalloc(COMPRESSED_DATA_NODE_BUF_SZ, GFP_KERNEL);
if (!c->write_reserve_buf)
if (!c->write_reserve_buf) {
err = -ENOMEM;
goto out;
}

err = ubifs_lpt_init(c, 0, 1);
if (err)
Expand Down Expand Up @@ -2063,8 +2065,10 @@ static int ubifs_fill_super(struct super_block *sb, void *data, int silent)
}

sb->s_root = d_make_root(root);
if (!sb->s_root)
if (!sb->s_root) {
err = -ENOMEM;
goto out_umount;
}

mutex_unlock(&c->umount_mutex);
return 0;
Expand Down

0 comments on commit 7203db9

Please sign in to comment.