btrfs: Fix uninitialized ret in btrfsic_process_superblock_dev_mirror
PATCH 1/1 btrfs: Fix uninitialized ret in btrfsic_process_superblock_dev_mirror
We could return ret uninitlaized in case of success. Before the code was returning 0 explicitly in case of success but now it will be a random value from the stack. That's due to ret being set only in error conditions.
--- fs/btrfs/check-integrity.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/check-integrity.c +1 -1
@@ -766,7 +766,7 @@ static int btrfsic_process_superblock_dev_mirror(struct block_device *const superblock_bdev = device->bdev;struct page *page;struct address_space *mapping = superblock_bdev->bd_inode->i_mapping; -int ret; +int ret =0 ;/* super block bytenr is always the unmapped device bytenr */ dev_bytenr =btrfs_sb_offset (superblock_mirror_num);
--
2.17.1
Quoted 5 lines · Nikolay Borisov
We could return ret uninitlaized in case of success. Before the code was returning 0 explicitly in case of success but now it will be a random value from the stack. That's due to ret being set only in error conditions.
Signed-off-by Nikolay Borisov <[email protected]>
This ideally has to be folded in:5a03d907a555 ("btrfs: remove buffer_heads form super block mirror integrity checking")
Quoted 20 lines
--- fs/btrfs/check-integrity.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/btrfs/check-integrity.c +1
-2@@ -766,7 +766,7 @@ static int btrfsic_process_superblock_dev_mirror(struct block_device *const superblock_bdev = device->bdev;struct page *page;struct address_space *mapping = superblock_bdev->bd_inode->i_mapping; -int ret; +int ret =0 ;/* super block bytenr is always the unmapped device bytenr */ dev_bytenr =btrfs_sb_offset (superblock_mirror_num); --2.17.1
Quoted 7 lines · Nikolay Borisov
Quoted 4 lines · Nikolay Borisov
We could return ret uninitlaized in case of success. Before the code was returning 0 explicitly in case of success but now it will be a random value from the stack. That's due to ret being set only in error conditions.
Quoted 5 lines
Quoted 1 line
Signed-off-by Nikolay Borisov <[email protected]>This ideally has to be folded in:
5a03d907a555("btrfs: removebuffer_headsform super block mirror integrity checking")
Folded and pushed, thanks.
Quoted 5 lines · Nikolay Borisov
We could return ret uninitlaized in case of success. Before the code was returning 0 explicitly in case of success but now it will be a random value from the stack. That's due to ret being set only in error conditions.
Signed-off-by Nikolay Borisov <[email protected]>
Thanks,
Qu
Quoted 20 lines
--- fs/btrfs/check-integrity.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/btrfs/check-integrity.c +1
-2@@ -766,7 +766,7 @@ static int btrfsic_process_superblock_dev_mirror(struct block_device *const superblock_bdev = device->bdev;struct page *page;struct address_space *mapping = superblock_bdev->bd_inode->i_mapping; -int ret; +int ret =0 ;/* super block bytenr is always the unmapped device bytenr */ dev_bytenr =btrfs_sb_offset (superblock_mirror_num); --2.17.1