dir.c (787b0893ad1e315ea014dc3f0e01a5bc9236c623) | dir.c (478c7835cb8ee28e73e732642866995f8555df7e) |
---|---|
1// SPDX-License-Identifier: GPL-2.0+ 2/* 3 * Copyright (C) 2017 Oracle. All Rights Reserved. 4 * Author: Darrick J. Wong <darrick.wong@oracle.com> 5 */ 6#include "xfs.h" 7#include "xfs_fs.h" 8#include "xfs_shared.h" --- 475 unchanged lines hidden (view full) --- 484 struct xfs_da_args *args, 485 xfs_dablk_t lblk) 486{ 487 struct xfs_dir3_icleaf_hdr leafhdr; 488 struct xfs_dir2_leaf_tail *ltp; 489 struct xfs_dir2_leaf *leaf; 490 struct xfs_buf *dbp; 491 struct xfs_buf *bp; | 1// SPDX-License-Identifier: GPL-2.0+ 2/* 3 * Copyright (C) 2017 Oracle. All Rights Reserved. 4 * Author: Darrick J. Wong <darrick.wong@oracle.com> 5 */ 6#include "xfs.h" 7#include "xfs_fs.h" 8#include "xfs_shared.h" --- 475 unchanged lines hidden (view full) --- 484 struct xfs_da_args *args, 485 xfs_dablk_t lblk) 486{ 487 struct xfs_dir3_icleaf_hdr leafhdr; 488 struct xfs_dir2_leaf_tail *ltp; 489 struct xfs_dir2_leaf *leaf; 490 struct xfs_buf *dbp; 491 struct xfs_buf *bp; |
492 const struct xfs_dir_ops *d_ops = sc->ip->d_ops; | |
493 struct xfs_da_geometry *geo = sc->mp->m_dir_geo; 494 __be16 *bestp; 495 __u16 best; 496 __u32 hash; 497 __u32 lasthash = 0; 498 __u32 bestcount; 499 unsigned int stale = 0; 500 int i; --- 23 unchanged lines hidden (view full) --- 524 * blocks that can fit under i_size. 525 */ 526 if (bestcount != xfs_dir2_byte_to_db(geo, sc->ip->i_d.di_size)) { 527 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, lblk); 528 goto out; 529 } 530 531 /* Is the leaf count even remotely sane? */ | 492 struct xfs_da_geometry *geo = sc->mp->m_dir_geo; 493 __be16 *bestp; 494 __u16 best; 495 __u32 hash; 496 __u32 lasthash = 0; 497 __u32 bestcount; 498 unsigned int stale = 0; 499 int i; --- 23 unchanged lines hidden (view full) --- 523 * blocks that can fit under i_size. 524 */ 525 if (bestcount != xfs_dir2_byte_to_db(geo, sc->ip->i_d.di_size)) { 526 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, lblk); 527 goto out; 528 } 529 530 /* Is the leaf count even remotely sane? */ |
532 if (leafhdr.count > d_ops->leaf_max_ents(geo)) { | 531 if (leafhdr.count > geo->leaf_max_ents) { |
533 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, lblk); 534 goto out; 535 } 536 537 /* Leaves and bests don't overlap in leaf format. */ 538 if ((char *)&leafhdr.ents[leafhdr.count] > (char *)bestp) { 539 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, lblk); 540 goto out; --- 312 unchanged lines hidden --- | 532 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, lblk); 533 goto out; 534 } 535 536 /* Leaves and bests don't overlap in leaf format. */ 537 if ((char *)&leafhdr.ents[leafhdr.count] > (char *)bestp) { 538 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, lblk); 539 goto out; --- 312 unchanged lines hidden --- |