]> git.baikalelectronics.ru Git - kernel.git/commit
xfs: Zero initialize highstale and lowstale in xfs_dir2_leafn_add
authorNathan Chancellor <natechancellor@gmail.com>
Fri, 8 Mar 2019 00:48:11 +0000 (16:48 -0800)
committerDarrick J. Wong <darrick.wong@oracle.com>
Fri, 8 Mar 2019 22:24:43 +0000 (14:24 -0800)
commit8ec1ee6f10e36870a3cfd9298b85c3e2b65f9311
treeda74c5c7bdc99caca27d720c8bfc6a3b8ace8b52
parent0d4acc08afa9ec2a09bbbe1a2fd013464afa73a1
xfs: Zero initialize highstale and lowstale in xfs_dir2_leafn_add

When building with -Wsometimes-uninitialized, Clang warns:

fs/xfs/libxfs/xfs_dir2_node.c:481:6: warning: variable 'lowstale' is
used uninitialized whenever 'if' condition is false
[-Wsometimes-uninitialized]
fs/xfs/libxfs/xfs_dir2_node.c:481:6: warning: variable 'highstale' is
used uninitialized whenever 'if' condition is false
[-Wsometimes-uninitialized]

While it isn't technically wrong, it isn't a problem in practice because
highstale and lowstale are only initialized in xfs_dir2_leafn_add when
compact is not zero then they are passed to xfs_dir3_leaf_find_entry,
where they are initialized before use when compact is zero. Regardless,
it's better not to be passing around uninitialized stack memory so zero
initialize these variables, which silences this warning.

Link: https://github.com/ClangBuiltLinux/linux/issues/393
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
fs/xfs/libxfs/xfs_dir2_node.c