Skip to content

Commit f51fac6

Browse files
committed
xfs: zero initialize highstale and lowstale in xfs_dir2_leaf_addname
Smatch complains about the following: fs/xfs/libxfs/xfs_dir2_leaf.c:848 xfs_dir2_leaf_addname() error: uninitialized symbol 'lowstale'. fs/xfs/libxfs/xfs_dir2_leaf.c:849 xfs_dir2_leaf_addname() error: uninitialized symbol 'highstale'. I don't think there's any incorrect behavior associated with the uninitialized variable, but as the author of the previous zero-init patch points out, it's best not to be passing around pointers to uninitialized stack areas. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Nathan Chancellor <natechancellor@gmail.com> Reviewed-by: Allison Henderson <allison.henderson@oracle.com> Reviewed-by: Bill O'Donnell <billodo@redhat.com>
1 parent 79622c7 commit f51fac6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/xfs/libxfs/xfs_dir2_leaf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ xfs_dir2_leaf_addname(
574574
xfs_dir2_data_unused_t *dup; /* data unused entry */
575575
int error; /* error return value */
576576
int grown; /* allocated new data block */
577-
int highstale; /* index of next stale leaf */
577+
int highstale = 0; /* index of next stale leaf */
578578
int i; /* temporary, index */
579579
int index; /* leaf table position */
580580
struct xfs_buf *lbp; /* leaf's buffer */
@@ -583,7 +583,7 @@ xfs_dir2_leaf_addname(
583583
xfs_dir2_leaf_entry_t *lep; /* leaf entry table pointer */
584584
int lfloglow; /* low leaf logging index */
585585
int lfloghigh; /* high leaf logging index */
586-
int lowstale; /* index of prev stale leaf */
586+
int lowstale = 0; /* index of prev stale leaf */
587587
xfs_dir2_leaf_tail_t *ltp; /* leaf tail pointer */
588588
int needbytes; /* leaf block bytes needed */
589589
int needlog; /* need to log data header */

0 commit comments

Comments
 (0)