All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] btrfs: reflink: Initialize return value to 0 in btrfs_extent_same()
@ 2021-08-26 14:44 Sidong Yang
  2021-08-26 15:11 ` Filipe Manana
  2021-08-26 15:17 ` David Sterba
  0 siblings, 2 replies; 3+ messages in thread
From: Sidong Yang @ 2021-08-26 14:44 UTC (permalink / raw)
  To: David Sterba, Filipe Manana, linux-btrfs, Nikolay Borisov; +Cc: Sidong Yang

This patch fixes a warning reported by smatch. It reported that ret
could be returned without initialized. 0 would be proper value for
initializing ret. Because dedupe operations are supposed to to return
0 for a 0 length range.

Signed-off-by: Sidong Yang <realwakka@gmail.com>
---
v2:
 - Removed assert and added initializing ret
v3:
 - Changed initializing value to 0
---
 fs/btrfs/reflink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/reflink.c b/fs/btrfs/reflink.c
index 9b0814318e72..c71e49782e86 100644
--- a/fs/btrfs/reflink.c
+++ b/fs/btrfs/reflink.c
@@ -649,7 +649,7 @@ static int btrfs_extent_same_range(struct inode *src, u64 loff, u64 len,
 static int btrfs_extent_same(struct inode *src, u64 loff, u64 olen,
 			     struct inode *dst, u64 dst_loff)
 {
-	int ret;
+	int ret = 0;
 	u64 i, tail_len, chunk_count;
 	struct btrfs_root *root_dst = BTRFS_I(dst)->root;
 
-- 
2.25.1


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

end of thread, other threads:[~2021-08-26 15:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-26 14:44 [PATCH v3] btrfs: reflink: Initialize return value to 0 in btrfs_extent_same() Sidong Yang
2021-08-26 15:11 ` Filipe Manana
2021-08-26 15:17 ` David Sterba

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.