* [PATCH] ext4: initialize err_blk before calling __ext4_get_inode_loc
@ 2021-12-01 16:34 Harshad Shirwadkar
2021-12-27 5:34 ` Theodore Ts'o
0 siblings, 1 reply; 2+ messages in thread
From: Harshad Shirwadkar @ 2021-12-01 16:34 UTC (permalink / raw)
To: linux-ext4; +Cc: Harshad Shirwadkar, Dan Carpenter
From: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
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>
---
fs/ext4/inode.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index bfd3545f1e5d..fbdd2dda57ae 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -4523,7 +4523,7 @@ static int __ext4_get_inode_loc(struct super_block *sb, unsigned long ino,
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,
@@ -4538,7 +4538,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,
--
2.34.0.rc2.393.gf8c9666880-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ext4: initialize err_blk before calling __ext4_get_inode_loc
2021-12-01 16:34 [PATCH] ext4: initialize err_blk before calling __ext4_get_inode_loc Harshad Shirwadkar
@ 2021-12-27 5:34 ` Theodore Ts'o
0 siblings, 0 replies; 2+ messages in thread
From: Theodore Ts'o @ 2021-12-27 5:34 UTC (permalink / raw)
To: Harshad Shirwadkar, linux-ext4; +Cc: Theodore Ts'o, Dan Carpenter
On Wed, 1 Dec 2021 08:34:21 -0800, Harshad Shirwadkar wrote:
> From: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
>
> 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.
>
>
> [...]
Applied, thanks!
[1/1] ext4: initialize err_blk before calling __ext4_get_inode_loc
commit: 613da7163720054004f596e5f5230753b50a7f45
Best regards,
--
Theodore Ts'o <tytso@mit.edu>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-12-27 5:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-01 16:34 [PATCH] ext4: initialize err_blk before calling __ext4_get_inode_loc Harshad Shirwadkar
2021-12-27 5:34 ` Theodore Ts'o
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.