udf: initialize newblock to 0
commit 23970a1c94
upstream.
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")
Reported-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Message-Id: <20221230175341.1629734-1-trix@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
c74b1cd93f
commit
41cb5369cb
|
@ -696,7 +696,7 @@ static sector_t inode_getblk(struct inode *inode, sector_t block,
|
||||||
struct kernel_lb_addr eloc, tmpeloc;
|
struct kernel_lb_addr eloc, tmpeloc;
|
||||||
int c = 1;
|
int c = 1;
|
||||||
loff_t lbcount = 0, b_off = 0;
|
loff_t lbcount = 0, b_off = 0;
|
||||||
udf_pblk_t newblocknum, newblock;
|
udf_pblk_t newblocknum, newblock = 0;
|
||||||
sector_t offset = 0;
|
sector_t offset = 0;
|
||||||
int8_t etype;
|
int8_t etype;
|
||||||
struct udf_inode_info *iinfo = UDF_I(inode);
|
struct udf_inode_info *iinfo = UDF_I(inode);
|
||||||
|
@ -799,7 +799,6 @@ static sector_t inode_getblk(struct inode *inode, sector_t block,
|
||||||
ret = udf_do_extend_file(inode, &prev_epos, laarr, hole_len);
|
ret = udf_do_extend_file(inode, &prev_epos, laarr, hole_len);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
*err = ret;
|
*err = ret;
|
||||||
newblock = 0;
|
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
c = 0;
|
c = 0;
|
||||||
|
@ -862,7 +861,6 @@ static sector_t inode_getblk(struct inode *inode, sector_t block,
|
||||||
goal, err);
|
goal, err);
|
||||||
if (!newblocknum) {
|
if (!newblocknum) {
|
||||||
*err = -ENOSPC;
|
*err = -ENOSPC;
|
||||||
newblock = 0;
|
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
if (isBeyondEOF)
|
if (isBeyondEOF)
|
||||||
|
|
Loading…
Reference in New Issue