2021-11-30 09:40:41

by Dan Carpenter

[permalink] [raw]
Subject: [bug report] ext4: fast commit recovery path

Hello Harshad Shirwadkar,

The patch 8016e29f4362: "ext4: fast commit recovery path" from Oct
15, 2020, leads to the following Smatch static checker warnings:

fs/ext4/inode.c:4533 __ext4_get_inode_loc_noinmem()
error: uninitialized symbol 'err_blk'.

fs/ext4/inode.c:4548 ext4_get_inode_loc()
error: uninitialized symbol 'err_blk'.

fs/ext4/inode.c
4523 static int __ext4_get_inode_loc_noinmem(struct inode *inode,
4524 struct ext4_iloc *iloc)
4525 {
4526 ext4_fsblk_t err_blk;
4527 int ret;
4528
4529 ret = __ext4_get_inode_loc(inode->i_sb, inode->i_ino, NULL, iloc,
4530 &err_blk);
4531
4532 if (ret == -EIO)
--> 4533 ext4_error_inode_block(inode, err_blk, EIO,

Only the last return -EIO sets err_blk. The first return -EIO leaves it
uninitialized.

4534 "unable to read itable block");
4535
4536 return ret;
4537 }

regards,
dan carpenter


2021-12-01 16:35:56

by harshad shirwadkar

[permalink] [raw]
Subject: Re: [bug report] ext4: fast commit recovery path

Thanks for the report Dan. This patch -
https://patchwork.ozlabs.org/project/linux-ext4/patch/[email protected]/
should take care of this report.

- Harshad

On Tue, Nov 30, 2021 at 1:40 AM Dan Carpenter <[email protected]> wrote:
>
> Hello Harshad Shirwadkar,
>
> The patch 8016e29f4362: "ext4: fast commit recovery path" from Oct
> 15, 2020, leads to the following Smatch static checker warnings:
>
> fs/ext4/inode.c:4533 __ext4_get_inode_loc_noinmem()
> error: uninitialized symbol 'err_blk'.
>
> fs/ext4/inode.c:4548 ext4_get_inode_loc()
> error: uninitialized symbol 'err_blk'.
>
> fs/ext4/inode.c
> 4523 static int __ext4_get_inode_loc_noinmem(struct inode *inode,
> 4524 struct ext4_iloc *iloc)
> 4525 {
> 4526 ext4_fsblk_t err_blk;
> 4527 int ret;
> 4528
> 4529 ret = __ext4_get_inode_loc(inode->i_sb, inode->i_ino, NULL, iloc,
> 4530 &err_blk);
> 4531
> 4532 if (ret == -EIO)
> --> 4533 ext4_error_inode_block(inode, err_blk, EIO,
>
> Only the last return -EIO sets err_blk. The first return -EIO leaves it
> uninitialized.
>
> 4534 "unable to read itable block");
> 4535
> 4536 return ret;
> 4537 }
>
> regards,
> dan carpenter