public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: Fix uninitialized ret in btrfsic_process_superblock_dev_mirror
@ 2020-02-24 12:56 Nikolay Borisov
  2020-02-24 12:57 ` Nikolay Borisov
  2020-02-24 13:00 ` Qu Wenruo
  0 siblings, 2 replies; 4+ messages in thread
From: Nikolay Borisov @ 2020-02-24 12:56 UTC (permalink / raw)
  To: linux-btrfs; +Cc: 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 <nborisov@suse.com>
---
 fs/btrfs/check-integrity.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c
index 23dd65e1c5e3..85b27e9742c8 100644
--- a/fs/btrfs/check-integrity.c
+++ b/fs/btrfs/check-integrity.c
@@ -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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-02-24 15:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-24 12:56 [PATCH] btrfs: Fix uninitialized ret in btrfsic_process_superblock_dev_mirror Nikolay Borisov
2020-02-24 12:57 ` Nikolay Borisov
2020-02-24 15:16   ` David Sterba
2020-02-24 13:00 ` Qu Wenruo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox