Skip to content

Commit bcdcb11

Browse files
nathanchancerichardweinberger
authored andcommitted
ubifs: Fix uninitialized use of err in ubifs_jnl_write_inode()
Clang warns (or errors with CONFIG_WERROR=y): fs/ubifs/journal.c:986:20: error: variable 'err' is uninitialized when used here [-Werror,-Wuninitialized] 986 | ubifs_ro_mode(c, err); | ^~~ Set err to -EPERM before the call to ubifs_ro_mode() and reuse it in the return statement to resolve the warning. Fixes: 957e1c4 ("ubifs: ubifs_jnl_write_inode: Only check once for the limitation of xattr count") Signed-off-by: Nathan Chancellor <nathan@kernel.org> Signed-off-by: Richard Weinberger <richard@nod.at>
1 parent fe05155 commit bcdcb11

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/ubifs/journal.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -983,8 +983,9 @@ int ubifs_jnl_write_inode(struct ubifs_info *c, const struct inode *inode)
983983

984984
if (kill_xattrs && ui->xattr_cnt > ubifs_xattr_max_cnt(c)) {
985985
ubifs_err(c, "Cannot delete inode, it has too much xattrs!");
986+
err = -EPERM;
986987
ubifs_ro_mode(c, err);
987-
return -EPERM;
988+
return err;
988989
}
989990

990991
/*

0 commit comments

Comments
 (0)