From a71895c5dad1ab8cf30622e208d148298ab602e5 Mon Sep 17 00:00:00 2001 From: "Darrick J. Wong" Date: Mon, 11 Nov 2019 12:53:22 -0800 Subject: 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 Reviewed-by: Christoph Hellwig --- fs/xfs/xfs_dir2_readdir.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'fs/xfs/xfs_dir2_readdir.c') 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; } -- cgit v1.2.3