public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Tom Rix <trix@redhat.com>
Cc: jack@suse.com, nathan@kernel.org, ndesaulniers@google.com,
	linux-kernel@vger.kernel.org, llvm@lists.linux.dev
Subject: Re: [PATCH] udf: initialize newblock to 0
Date: Mon, 2 Jan 2023 13:50:20 +0100	[thread overview]
Message-ID: <20230102125020.fg5m6aqz3ca4f2mt@quack3> (raw)
In-Reply-To: <20221230175341.1629734-1-trix@redhat.com>

On Fri 30-12-22 12:53:41, Tom Rix wrote:
> The clang build reports this error
> fs/udf/inode.c:805:6: error: variable 'newblock' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
>         if (*err < 0)
>             ^~~~~~~~
> newblock is never set before error handling jump.
> Initialize newblock to 0 and remove redundant settings.
> 
> Fixes: d8b39db5fab8 ("udf: Handle error when adding extent to a file")
> Signed-off-by: Tom Rix <trix@redhat.com>

Thanks! I've added the patch to my tree.

								Honza

> ---
>  fs/udf/inode.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/fs/udf/inode.c b/fs/udf/inode.c
> index 4a912e2edcec..31965c3798f2 100644
> --- a/fs/udf/inode.c
> +++ b/fs/udf/inode.c
> @@ -604,7 +604,7 @@ static sector_t inode_getblk(struct inode *inode, sector_t block,
>  	struct kernel_lb_addr eloc, tmpeloc;
>  	int c = 1;
>  	loff_t lbcount = 0, b_off = 0;
> -	udf_pblk_t newblocknum, newblock;
> +	udf_pblk_t newblocknum, newblock = 0;
>  	sector_t offset = 0;
>  	int8_t etype;
>  	struct udf_inode_info *iinfo = UDF_I(inode);
> @@ -710,7 +710,6 @@ static sector_t inode_getblk(struct inode *inode, sector_t block,
>  		ret = udf_do_extend_file(inode, &prev_epos, laarr, hole_len);
>  		if (ret < 0) {
>  			*err = ret;
> -			newblock = 0;
>  			goto out_free;
>  		}
>  		c = 0;
> @@ -775,7 +774,6 @@ static sector_t inode_getblk(struct inode *inode, sector_t block,
>  				goal, err);
>  		if (!newblocknum) {
>  			*err = -ENOSPC;
> -			newblock = 0;
>  			goto out_free;
>  		}
>  		if (isBeyondEOF)
> -- 
> 2.27.0
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

      reply	other threads:[~2023-01-02 12:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-30 17:53 [PATCH] udf: initialize newblock to 0 Tom Rix
2023-01-02 12:50 ` Jan Kara [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=20230102125020.fg5m6aqz3ca4f2mt@quack3 \
    --to=jack@suse.cz \
    --cc=jack@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --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