summaryrefslogtreecommitdiff
path: root/fs/ubifs
diff options
context:
space:
mode:
authorNathan Chancellor <nathan@kernel.org>2024-11-15 09:10:04 -0700
committerRichard Weinberger <richard@nod.at>2024-11-15 17:45:25 +0100
commitbcdcb115eaed5e988cf37cc9a1dd5f5dd200e927 (patch)
tree7abd2c35c845555766d30451a88cf5c9997ed219 /fs/ubifs
parentfe051552f5078fa02d593847529a3884305a6ffe (diff)
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: 957e1c4e1779 ("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>
Diffstat (limited to 'fs/ubifs')
-rw-r--r--fs/ubifs/journal.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/ubifs/journal.c b/fs/ubifs/journal.c
index 8e98be642371..36ba79fbd2ff 100644
--- a/fs/ubifs/journal.c
+++ b/fs/ubifs/journal.c
@@ -983,8 +983,9 @@ int ubifs_jnl_write_inode(struct ubifs_info *c, const struct inode *inode)
if (kill_xattrs && ui->xattr_cnt > ubifs_xattr_max_cnt(c)) {
ubifs_err(c, "Cannot delete inode, it has too much xattrs!");
+ err = -EPERM;
ubifs_ro_mode(c, err);
- return -EPERM;
+ return err;
}
/*