summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_dir2_readdir.c
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2019-11-11 12:53:22 -0800
committerDarrick J. Wong <darrick.wong@oracle.com>2019-11-13 11:08:01 -0800
commita71895c5dad1ab8cf30622e208d148298ab602e5 (patch)
treecb6ab48f015524f584a1a920fbed3709f48763d4 /fs/xfs/xfs_dir2_readdir.c
parentf9e0370648b9f9908ec97f44459a1152aecbbf45 (diff)
xfs: convert open coded corruption check to use XFS_IS_CORRUPT
Convert the last of the open coded corruption check and report idioms to use the XFS_IS_CORRUPT macro. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/xfs/xfs_dir2_readdir.c')
-rw-r--r--fs/xfs/xfs_dir2_readdir.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/fs/xfs/xfs_dir2_readdir.c b/fs/xfs/xfs_dir2_readdir.c
index b149cb4a4d86..95bc9ef8f5f9 100644
--- a/fs/xfs/xfs_dir2_readdir.c
+++ b/fs/xfs/xfs_dir2_readdir.c
@@ -117,11 +117,10 @@ xfs_dir2_sf_getdents(
ino = xfs_dir2_sf_get_ino(mp, sfp, sfep);
filetype = xfs_dir2_sf_get_ftype(mp, sfep);
ctx->pos = off & 0x7fffffff;
- if (!xfs_dir2_namecheck(sfep->name, sfep->namelen)) {
- XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW,
- dp->i_mount);
+ if (XFS_IS_CORRUPT(dp->i_mount,
+ !xfs_dir2_namecheck(sfep->name,
+ sfep->namelen)))
return -EFSCORRUPTED;
- }
if (!dir_emit(ctx, (char *)sfep->name, sfep->namelen, ino,
xfs_dir3_get_dtype(mp, filetype)))
return 0;
@@ -207,9 +206,9 @@ xfs_dir2_block_getdents(
/*
* If it didn't fit, set the final offset to here & return.
*/
- if (!xfs_dir2_namecheck(dep->name, dep->namelen)) {
- XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW,
- dp->i_mount);
+ if (XFS_IS_CORRUPT(dp->i_mount,
+ !xfs_dir2_namecheck(dep->name,
+ dep->namelen))) {
error = -EFSCORRUPTED;
goto out_rele;
}
@@ -459,9 +458,9 @@ xfs_dir2_leaf_getdents(
filetype = xfs_dir2_data_get_ftype(mp, dep);
ctx->pos = xfs_dir2_byte_to_dataptr(curoff) & 0x7fffffff;
- if (!xfs_dir2_namecheck(dep->name, dep->namelen)) {
- XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW,
- dp->i_mount);
+ if (XFS_IS_CORRUPT(dp->i_mount,
+ !xfs_dir2_namecheck(dep->name,
+ dep->namelen))) {
error = -EFSCORRUPTED;
break;
}