Commit c27c29c6 authored by Harshad Shirwadkar's avatar Harshad Shirwadkar Committed by Theodore Ts'o

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: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarHarshad Shirwadkar <harshadshirwadkar@gmail.com>
Link: https://lore.kernel.org/r/20211201163421.2631661-1-harshads@google.comSigned-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
Cc: stable@kernel.org
parent 8c80fb31
...@@ -4524,7 +4524,7 @@ static int __ext4_get_inode_loc(struct super_block *sb, unsigned long ino, ...@@ -4524,7 +4524,7 @@ static int __ext4_get_inode_loc(struct super_block *sb, unsigned long ino,
static int __ext4_get_inode_loc_noinmem(struct inode *inode, static int __ext4_get_inode_loc_noinmem(struct inode *inode,
struct ext4_iloc *iloc) struct ext4_iloc *iloc)
{ {
ext4_fsblk_t err_blk; ext4_fsblk_t err_blk = 0;
int ret; int ret;
ret = __ext4_get_inode_loc(inode->i_sb, inode->i_ino, NULL, iloc, 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, ...@@ -4539,7 +4539,7 @@ static int __ext4_get_inode_loc_noinmem(struct inode *inode,
int ext4_get_inode_loc(struct inode *inode, struct ext4_iloc *iloc) int ext4_get_inode_loc(struct inode *inode, struct ext4_iloc *iloc)
{ {
ext4_fsblk_t err_blk; ext4_fsblk_t err_blk = 0;
int ret; int ret;
ret = __ext4_get_inode_loc(inode->i_sb, inode->i_ino, inode, iloc, ret = __ext4_get_inode_loc(inode->i_sb, inode->i_ino, inode, iloc,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment