summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_attr_list.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_attr_list.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_attr_list.c')
-rw-r--r--fs/xfs/xfs_attr_list.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/fs/xfs/xfs_attr_list.c b/fs/xfs/xfs_attr_list.c
index 0ec6606149a2..7a099df88a0c 100644
--- a/fs/xfs/xfs_attr_list.c
+++ b/fs/xfs/xfs_attr_list.c
@@ -86,11 +86,10 @@ xfs_attr_shortform_list(
(XFS_ISRESET_CURSOR(cursor) &&
(dp->i_afp->if_bytes + sf->hdr.count * 16) < context->bufsize)) {
for (i = 0, sfe = &sf->list[0]; i < sf->hdr.count; i++) {
- if (!xfs_attr_namecheck(sfe->nameval, sfe->namelen)) {
- XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW,
- context->dp->i_mount);
+ if (XFS_IS_CORRUPT(context->dp->i_mount,
+ !xfs_attr_namecheck(sfe->nameval,
+ sfe->namelen)))
return -EFSCORRUPTED;
- }
context->put_listent(context,
sfe->flags,
sfe->nameval,
@@ -179,9 +178,9 @@ xfs_attr_shortform_list(
cursor->hashval = sbp->hash;
cursor->offset = 0;
}
- if (!xfs_attr_namecheck(sbp->name, sbp->namelen)) {
- XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW,
- context->dp->i_mount);
+ if (XFS_IS_CORRUPT(context->dp->i_mount,
+ !xfs_attr_namecheck(sbp->name,
+ sbp->namelen))) {
error = -EFSCORRUPTED;
goto out;
}
@@ -269,10 +268,8 @@ xfs_attr_node_list_lookup(
return 0;
/* We can't point back to the root. */
- if (cursor->blkno == 0) {
- XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, mp);
+ if (XFS_IS_CORRUPT(mp, cursor->blkno == 0))
return -EFSCORRUPTED;
- }
}
if (expected_level != 0)
@@ -473,11 +470,9 @@ xfs_attr3_leaf_list_int(
valuelen = be32_to_cpu(name_rmt->valuelen);
}
- if (!xfs_attr_namecheck(name, namelen)) {
- XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW,
- context->dp->i_mount);
+ if (XFS_IS_CORRUPT(context->dp->i_mount,
+ !xfs_attr_namecheck(name, namelen)))
return -EFSCORRUPTED;
- }
context->put_listent(context, entry->flags,
name, namelen, valuelen);
if (context->seen_enough)