From: Konstantin Komarov Date: Fri, 7 Oct 2022 17:23:19 +0000 (+0300) Subject: fs/ntfs3: Correct ntfs_check_for_free_space X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=6f80ed14d76c730f7943777ba259cd32870e6433;p=linux.git fs/ntfs3: Correct ntfs_check_for_free_space zlen in some cases was bigger than correct value. Signed-off-by: Konstantin Komarov --- diff --git a/fs/ntfs3/fsntfs.c b/fs/ntfs3/fsntfs.c index 4f04e8594a8fe..6a1e000fd2b53 100644 --- a/fs/ntfs3/fsntfs.c +++ b/fs/ntfs3/fsntfs.c @@ -456,7 +456,7 @@ bool ntfs_check_for_free_space(struct ntfs_sb_info *sbi, CLST clen, CLST mlen) wnd = &sbi->used.bitmap; down_read_nested(&wnd->rw_lock, BITMAP_MUTEX_CLUSTERS); free = wnd_zeroes(wnd); - zlen = wnd_zone_len(wnd); + zlen = min_t(size_t, NTFS_MIN_MFT_ZONE, wnd_zone_len(wnd)); up_read(&wnd->rw_lock); if (free < zlen + clen)