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 <dan.carpenter@oracle.com> Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com> Link: https://lore.kernel.org/r/20211201163421.2631661-1-harshads@google.com Signed-off-by: Theodore Ts'o <tytso@mit.edu> Cc: stable@kernel.org
This commit is contained in:
parent
8c80fb312d
commit
c27c29c6af
@ -4524,7 +4524,7 @@ has_buffer:
|
||||
static int __ext4_get_inode_loc_noinmem(struct inode *inode,
|
||||
struct ext4_iloc *iloc)
|
||||
{
|
||||
ext4_fsblk_t err_blk;
|
||||
ext4_fsblk_t err_blk = 0;
|
||||
int ret;
|
||||
|
||||
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,
|
||||
|
||||
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;
|
||||
|
||||
ret = __ext4_get_inode_loc(inode->i_sb, inode->i_ino, inode, iloc,
|
||||
|
Loading…
Reference in New Issue
Block a user