[PATCH] xfs: don't ASSERT on corrupt ftype

Eric Sandeen sandeen at redhat.com
Sun Sep 7 20:06:35 CDT 2014


xfs_dir3_data_get_ftype() and xfs_dir2_sf_check() get
the file type off disk, but ASSERT if it's invalid:

	ASSERT(type < XFS_DIR3_FT_MAX);

This might be cut & paste from the "put" functions,
which should be checking that they've not been passed
bad values, but we shouldn't ASSERT on bad values
read from disk.

Signed-off-by: Eric Sandeen <sandeen at redhat.com>
---

diff --git a/fs/xfs/libxfs/xfs_da_format.c b/fs/xfs/libxfs/xfs_da_format.c
index c9aee52..7e42fdf 100644
--- a/fs/xfs/libxfs/xfs_da_format.c
+++ b/fs/xfs/libxfs/xfs_da_format.c
@@ -270,7 +270,6 @@ xfs_dir3_data_get_ftype(
  {
  	__uint8_t	ftype = dep->name[dep->namelen];
  
-	ASSERT(ftype < XFS_DIR3_FT_MAX);
  	if (ftype >= XFS_DIR3_FT_MAX)
  		return XFS_DIR3_FT_UNKNOWN;
  	return ftype;
diff --git a/fs/xfs/libxfs/xfs_dir2_sf.c b/fs/xfs/libxfs/xfs_dir2_sf.c
index 5079e05..ea89250 100644
--- a/fs/xfs/libxfs/xfs_dir2_sf.c
+++ b/fs/xfs/libxfs/xfs_dir2_sf.c
@@ -635,7 +635,6 @@ xfs_dir2_sf_check(
  		offset =
  			xfs_dir2_sf_get_offset(sfep) +
  			dp->d_ops->data_entsize(sfep->namelen);
-		ASSERT(dp->d_ops->sf_get_ftype(sfep) < XFS_DIR3_FT_MAX);
  	}
  	ASSERT(i8count == sfp->i8count);
  	ASSERT((char *)sfep - (char *)sfp == dp->i_d.di_size);



More information about the xfs mailing list