Skip to content

Commit c27c29c

Browse files
harshadjstytso
authored andcommitted
ext4: initialize err_blk before calling __ext4_get_inode_loc
It is not guaranteed that __ext4_get_inode_loc will definitely set err_blk pointer when it returns EIO. To avoid using uninitialized variables, let's first set err_blk to 0. Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Harshad Shirwadkar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Theodore Ts'o <[email protected]> Cc: [email protected]
1 parent 8c80fb3 commit c27c29c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/ext4/inode.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4524,7 +4524,7 @@ static int __ext4_get_inode_loc(struct super_block *sb, unsigned long ino,
45244524
static int __ext4_get_inode_loc_noinmem(struct inode *inode,
45254525
struct ext4_iloc *iloc)
45264526
{
4527-
ext4_fsblk_t err_blk;
4527+
ext4_fsblk_t err_blk = 0;
45284528
int ret;
45294529

45304530
ret = __ext4_get_inode_loc(inode->i_sb, inode->i_ino, NULL, iloc,
@@ -4539,7 +4539,7 @@ static int __ext4_get_inode_loc_noinmem(struct inode *inode,
45394539

45404540
int ext4_get_inode_loc(struct inode *inode, struct ext4_iloc *iloc)
45414541
{
4542-
ext4_fsblk_t err_blk;
4542+
ext4_fsblk_t err_blk = 0;
45434543
int ret;
45444544

45454545
ret = __ext4_get_inode_loc(inode->i_sb, inode->i_ino, inode, iloc,

0 commit comments

Comments
 (0)