]> Git Repo - J-linux.git/commitdiff
ubifs: Fix uninitialized use of err in ubifs_jnl_write_inode()
authorNathan Chancellor <[email protected]>
Fri, 15 Nov 2024 16:10:04 +0000 (09:10 -0700)
committerRichard Weinberger <[email protected]>
Fri, 15 Nov 2024 16:45:25 +0000 (17:45 +0100)
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 <[email protected]>
Signed-off-by: Richard Weinberger <[email protected]>
fs/ubifs/journal.c

index 8e98be64237154105cd6f7cb62cf0338ac26d3e9..36ba79fbd2ff80ff3d5c1f0bf965e439d8c55ab2 100644 (file)
@@ -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;
        }
 
        /*
This page took 0.042808 seconds and 4 git commands to generate.