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

Commit ab7eac22 authored by Brian Foster's avatar Brian Foster Committed by Ben Myers
Browse files

xfs: remove int casts from debug dquot soft limit timer asserts



The int casts here make it easy to trigger an assert with a large
soft limit. For example, set a >4TB soft limit on an empty volume
to reproduce a (0 > -x) comparison due to an overflow of
d_blk_softlimit.

Signed-off-by: default avatarBrian Foster <bfoster@redhat.com>
Reviewed-by: default avatarBen Myers <bpm@sgi.com>
Signed-off-by: default avatarBen Myers <bpm@sgi.com>
parent 91e4bac0
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -784,11 +784,11 @@ xfs_qm_scall_getquota(
	     (XFS_IS_OQUOTA_ENFORCED(mp) &&
	     (XFS_IS_OQUOTA_ENFORCED(mp) &&
			(dst->d_flags & (FS_PROJ_QUOTA | FS_GROUP_QUOTA)))) &&
			(dst->d_flags & (FS_PROJ_QUOTA | FS_GROUP_QUOTA)))) &&
	    dst->d_id != 0) {
	    dst->d_id != 0) {
		if (((int) dst->d_bcount > (int) dst->d_blk_softlimit) &&
		if ((dst->d_bcount > dst->d_blk_softlimit) &&
		    (dst->d_blk_softlimit > 0)) {
		    (dst->d_blk_softlimit > 0)) {
			ASSERT(dst->d_btimer != 0);
			ASSERT(dst->d_btimer != 0);
		}
		}
		if (((int) dst->d_icount > (int) dst->d_ino_softlimit) &&
		if ((dst->d_icount > dst->d_ino_softlimit) &&
		    (dst->d_ino_softlimit > 0)) {
		    (dst->d_ino_softlimit > 0)) {
			ASSERT(dst->d_itimer != 0);
			ASSERT(dst->d_itimer != 0);
		}
		}