summaryrefslogtreecommitdiffstats
path: root/fs/xfs/libxfs/xfs_btree.h
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2017-02-02 15:13:58 -0800
committerDarrick J. Wong <darrick.wong@oracle.com>2017-02-02 15:13:58 -0800
commitd5a91baeb6033c3392121e4d5c011cdc08dfa9f7 (patch)
treef8a831534ecc6270b9cf57164de9e881b46ce02c /fs/xfs/libxfs/xfs_btree.h
parent7a652bbe366464267190c2792a32ce4fff5595ef (diff)
downloadlinux-stable-d5a91baeb6033c3392121e4d5c011cdc08dfa9f7.tar.gz
linux-stable-d5a91baeb6033c3392121e4d5c011cdc08dfa9f7.tar.bz2
linux-stable-d5a91baeb6033c3392121e4d5c011cdc08dfa9f7.zip
xfs: filter out obviously bad btree pointers
Don't let anybody load an obviously bad btree pointer. Since the values come from disk, we must return an error, not just ASSERT. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Diffstat (limited to 'fs/xfs/libxfs/xfs_btree.h')
-rw-r--r--fs/xfs/libxfs/xfs_btree.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/xfs/libxfs/xfs_btree.h b/fs/xfs/libxfs/xfs_btree.h
index cdd4f05a5976..4bb62580a7fd 100644
--- a/fs/xfs/libxfs/xfs_btree.h
+++ b/fs/xfs/libxfs/xfs_btree.h
@@ -458,7 +458,7 @@ static inline int xfs_btree_get_level(struct xfs_btree_block *block)
#define XFS_FILBLKS_MAX(a,b) max_t(xfs_filblks_t, (a), (b))
#define XFS_FSB_SANITY_CHECK(mp,fsb) \
- (XFS_FSB_TO_AGNO(mp, fsb) < mp->m_sb.sb_agcount && \
+ (fsb && XFS_FSB_TO_AGNO(mp, fsb) < mp->m_sb.sb_agcount && \
XFS_FSB_TO_AGBNO(mp, fsb) < mp->m_sb.sb_agblocks)
/*