Re: [PATCH v3] btrfs: reflink: Initialize return value to 0 in btrfs_extent_same()
From: Filipe Manana <hidden>
Date: 2021-08-26 15:11:51
On Thu, Aug 26, 2021 at 3:44 PM Sidong Yang [off-list ref] wrote:
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 <redacted>
Reviewed-by: Filipe Manana <redacted> Looks good, thanks.
quoted hunk ↗ jump to hunk
--- 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
-- Filipe David Manana, “Whether you think you can, or you think you can't — you're right.”