]> Gentwo Git Trees - linux/.git/commitdiff
fs: ext4: fix uninitialized symbols
authorRanganath V N <vnranganath.20@gmail.com>
Sat, 11 Oct 2025 06:38:29 +0000 (12:08 +0530)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 6 Nov 2025 15:34:20 +0000 (10:34 -0500)
Fix the issue detected by the smatch tool.

fs/ext4/inode.c:3583 ext4_map_blocks_atomic_write_slow() error: uninitialized symbol 'next_pblk'.
fs/ext4/namei.c:1776 ext4_lookup() error: uninitialized symbol 'de'.
fs/ext4/namei.c:1829 ext4_get_parent() error: uninitialized symbol 'de'.
fs/ext4/namei.c:3162 ext4_rmdir() error: uninitialized symbol 'de'.
fs/ext4/namei.c:3242 __ext4_unlink() error: uninitialized symbol 'de'.
fs/ext4/namei.c:3697 ext4_find_delete_entry() error: uninitialized symbol 'de'.

These changes enhance code clarity, address static analysis tool errors.

Signed-off-by: Ranganath V N <vnranganath.20@gmail.com>
Message-ID: <20251011063830.47485-1-vnranganath.20@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/inode.c
fs/ext4/namei.c

index e99306a8f47ce7c3945782b780b7e0e9b160f978..6356340b768de438a3da5e84f245f6e925f00cd1 100644 (file)
@@ -3544,7 +3544,7 @@ static int ext4_map_blocks_atomic_write_slow(handle_t *handle,
        ext4_lblk_t m_lblk = map->m_lblk;
        unsigned int m_len = map->m_len;
        unsigned int mapped_len = 0, m_flags = 0;
-       ext4_fsblk_t next_pblk;
+       ext4_fsblk_t next_pblk = 0;
        bool check_next_pblk = false;
        int ret = 0;
 
index 2cd36f59c9e363124ee949f742adccd88447295a..045616033515a2e61327156337c39cf6ff0d570a 100644 (file)
@@ -1762,7 +1762,7 @@ static struct buffer_head * ext4_dx_find_entry(struct inode *dir,
 static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags)
 {
        struct inode *inode;
-       struct ext4_dir_entry_2 *de;
+       struct ext4_dir_entry_2 *de = NULL;
        struct buffer_head *bh;
 
        if (dentry->d_name.len > EXT4_NAME_LEN)
@@ -1818,7 +1818,7 @@ static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, unsi
 struct dentry *ext4_get_parent(struct dentry *child)
 {
        __u32 ino;
-       struct ext4_dir_entry_2 * de;
+       struct ext4_dir_entry_2 * de = NULL;
        struct buffer_head *bh;
 
        bh = ext4_find_entry(d_inode(child), &dotdot_name, &de, NULL);
@@ -3133,7 +3133,7 @@ static int ext4_rmdir(struct inode *dir, struct dentry *dentry)
        int retval;
        struct inode *inode;
        struct buffer_head *bh;
-       struct ext4_dir_entry_2 *de;
+       struct ext4_dir_entry_2 *de = NULL;
        handle_t *handle = NULL;
 
        retval = ext4_emergency_state(dir->i_sb);
@@ -3224,7 +3224,7 @@ int __ext4_unlink(struct inode *dir, const struct qstr *d_name,
 {
        int retval = -ENOENT;
        struct buffer_head *bh;
-       struct ext4_dir_entry_2 *de;
+       struct ext4_dir_entry_2 *de = NULL;
        handle_t *handle;
        int skip_remove_dentry = 0;
 
@@ -3688,7 +3688,7 @@ static int ext4_find_delete_entry(handle_t *handle, struct inode *dir,
 {
        int retval = -ENOENT;
        struct buffer_head *bh;
-       struct ext4_dir_entry_2 *de;
+       struct ext4_dir_entry_2 *de = NULL;
 
        bh = ext4_find_entry(dir, d_name, &de, NULL);
        if (IS_ERR(bh))