xfs: limit entries returned when counting fsmap records
authorDarrick J. Wong <darrick.wong@oracle.com>
Thu, 1 Oct 2020 17:56:07 +0000 (10:56 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Wed, 7 Oct 2020 15:40:29 +0000 (08:40 -0700)
commitacd1ac3aa22fd58803a12d26b1ab7f70232f8d8d
tree92a1d1bad509ebe50a716e99a1103c85b6686944
parent74f4d6a1e065c92428c5b588099e307a582d79d9
xfs: limit entries returned when counting fsmap records

If userspace asked fsmap to count the number of entries, we cannot
return more than UINT_MAX entries because fmh_entries is u32.
Therefore, stop counting if we hit this limit or else we will waste time
to return truncated results.

Fixes: e89c041338ed ("xfs: implement the GETFSMAP ioctl")
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com>
fs/xfs/xfs_fsmap.c