Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 587aa0fe authored by Dave Chinner's avatar Dave Chinner
Browse files

xfs: rearrange xfs_mod_sb() to avoid array subscript warning



gcc warns of an array subscript out of bounds in xfs_mod_sb().
The code is written in such a way that if the array subscript is
out of bounds, then it will assert fail. Rearrange the code to
avoid the bounds check warning.

Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
parent f0a0eaa8
Loading
Loading
Loading
Loading
+3 −4
Original line number Original line Diff line number Diff line
@@ -1631,15 +1631,14 @@ xfs_mod_sb(xfs_trans_t *tp, __int64_t fields)
	xfs_sb_to_disk(XFS_BUF_TO_SBP(bp), &mp->m_sb, fields);
	xfs_sb_to_disk(XFS_BUF_TO_SBP(bp), &mp->m_sb, fields);


	/* find modified range */
	/* find modified range */
	f = (xfs_sb_field_t)xfs_highbit64((__uint64_t)fields);
	ASSERT((1LL << f) & XFS_SB_MOD_BITS);
	last = xfs_sb_info[f + 1].offset - 1;


	f = (xfs_sb_field_t)xfs_lowbit64((__uint64_t)fields);
	f = (xfs_sb_field_t)xfs_lowbit64((__uint64_t)fields);
	ASSERT((1LL << f) & XFS_SB_MOD_BITS);
	ASSERT((1LL << f) & XFS_SB_MOD_BITS);
	first = xfs_sb_info[f].offset;
	first = xfs_sb_info[f].offset;


	f = (xfs_sb_field_t)xfs_highbit64((__uint64_t)fields);
	ASSERT((1LL << f) & XFS_SB_MOD_BITS);
	last = xfs_sb_info[f + 1].offset - 1;

	xfs_trans_log_buf(tp, bp, first, last);
	xfs_trans_log_buf(tp, bp, first, last);
}
}