btrfs: reflink: Initialize return value to 0 in btrfs_extent_same()
PATCH v3 1/1 btrfs: reflink: Initialize return value to 0 in btrfs_extent_same()
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.
---
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(-)
fs/btrfs/reflink.c +1 -1
@@ -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;
Signature · 1 line
2.25.1
Quoted 7 lines · 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 <[email protected]>
Looks good, thanks.
Quoted 25 lines
---
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(-)fs/btrfs/reflink.c +1
-2@@ -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
Signature · 3 lines
Filipe David Manana, “Whether you think you can, or you think you can't — you're right.”
Quoted 11 lines · 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 <[email protected]>---
v2:
- Removed assert and added initializing ret
v3:
- Changed initializing value to 0
I've slightly rephrased the changelog, added to misc-next, thanks.