Skip to content

Commit 23970a1

Browse files
Tom Rixjankara
authored andcommitted
udf: initialize newblock to 0
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: d8b39db ("udf: Handle error when adding extent to a file") Reported-by: Nathan Chancellor <[email protected]> Signed-off-by: Tom Rix <[email protected]> Signed-off-by: Jan Kara <[email protected]> Message-Id: <[email protected]>
1 parent 83c7423 commit 23970a1

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

fs/udf/inode.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ static sector_t inode_getblk(struct inode *inode, sector_t block,
684684
struct kernel_lb_addr eloc, tmpeloc;
685685
int c = 1;
686686
loff_t lbcount = 0, b_off = 0;
687-
udf_pblk_t newblocknum, newblock;
687+
udf_pblk_t newblocknum, newblock = 0;
688688
sector_t offset = 0;
689689
int8_t etype;
690690
struct udf_inode_info *iinfo = UDF_I(inode);
@@ -787,7 +787,6 @@ static sector_t inode_getblk(struct inode *inode, sector_t block,
787787
ret = udf_do_extend_file(inode, &prev_epos, laarr, hole_len);
788788
if (ret < 0) {
789789
*err = ret;
790-
newblock = 0;
791790
goto out_free;
792791
}
793792
c = 0;
@@ -852,7 +851,6 @@ static sector_t inode_getblk(struct inode *inode, sector_t block,
852851
goal, err);
853852
if (!newblocknum) {
854853
*err = -ENOSPC;
855-
newblock = 0;
856854
goto out_free;
857855
}
858856
if (isBeyondEOF)

0 commit comments

Comments
 (0)