linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nikolay Borisov <nborisov@suse.com>
To: trix@redhat.com, clm@fb.com, josef@toxicpanda.com, dsterba@suse.com
Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] btfrs: initialize return of btrfs_extent_same
Date: Sun, 5 Jul 2020 17:48:34 +0300	[thread overview]
Message-ID: <6b1d0837-e898-c5b2-c212-4ce1f2d41cdb@suse.com> (raw)
In-Reply-To: <20200705142058.28305-1-trix@redhat.com>



On 5.07.20 г. 17:20 ч., trix@redhat.com wrote:
> From: Tom Rix <trix@redhat.com>
> 
> clang static analysis flags a garbage return
> 
> fs/btrfs/reflink.c:611:2: warning: Undefined or garbage value returned to caller [core.uninitialized.UndefReturn]
>         return ret;
>         ^~~~~~~~~~
> ret will not be set when olen is 0
> When olen is 0, this function does no work.
> 
> So initialize ret to 0
> 
> Signed-off-by: Tom Rix <trix@redhat.com>

And I forgot:

Reviewed-by: Nikolay Borisov <nborisov@suse.com>

> ---
>  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 040009d1cc31..200a80fcbecb 100644
> --- a/fs/btrfs/reflink.c
> +++ b/fs/btrfs/reflink.c
> @@ -572,7 +572,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;
>  
> 

      parent reply	other threads:[~2020-07-05 14:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-05 14:20 [PATCH] btfrs: initialize return of btrfs_extent_same trix
2020-07-05 14:48 ` Nikolay Borisov
2020-07-07 15:47   ` David Sterba
2020-07-05 14:48 ` Nikolay Borisov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6b1d0837-e898-c5b2-c212-4ce1f2d41cdb@suse.com \
    --to=nborisov@suse.com \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=trix@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).