* [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
* Re: [PATCH v3] btrfs: reflink: Initialize return value to 0 in btrfs_extent_same()
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
1 sibling, 0 replies; 3+ messages in thread
From: Filipe Manana @ 2021-08-26 15:11 UTC (permalink / raw)
To: Sidong Yang; +Cc: David Sterba, linux-btrfs, Nikolay Borisov
On Thu, Aug 26, 2021 at 3:44 PM Sidong Yang <realwakka@gmail.com> 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 <realwakka@gmail.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Looks good, thanks.
> ---
> 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.”
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3] btrfs: reflink: Initialize return value to 0 in btrfs_extent_same()
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
1 sibling, 0 replies; 3+ messages in thread
From: David Sterba @ 2021-08-26 15:17 UTC (permalink / raw)
To: Sidong Yang; +Cc: David Sterba, Filipe Manana, linux-btrfs, Nikolay Borisov
On Thu, Aug 26, 2021 at 02:44:36PM +0000, Sidong Yang 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 <realwakka@gmail.com>
> ---
> v2:
> - Removed assert and added initializing ret
> v3:
> - Changed initializing value to 0
I've slightly rephrased the changelog, added to misc-next, thanks.
^ permalink raw reply [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.