Skip to content

Commit 426f07a

Browse files
author
Al Viro
committed
ufs_free_fragments(): fix the braino in sanity check
The function expects that all fragments it's been asked to free will be within the same block. And it even has a sanity check verifying that - it takes the fragment number modulo the number of fragments per block, adds the count and checks if that's too high. Unfortunately, it misspells the upper limit - instead of ->s_fpb (fragments per block) it says ->s_fpg (fragments per cylinder group). So "too high" ends up being insanely lenient. Had been that way since 2.1.112, when UFS write support had been added. 27 years to spot a typo... Signed-off-by: Al Viro <[email protected]>
1 parent c5df105 commit 426f07a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/ufs/balloc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ void ufs_free_fragments(struct inode *inode, u64 fragment, unsigned count)
5050
UFSD("ENTER, fragment %llu, count %u\n",
5151
(unsigned long long)fragment, count);
5252

53-
if (ufs_fragnum(fragment) + count > uspi->s_fpg)
53+
if (ufs_fragnum(fragment) + count > uspi->s_fpb)
5454
ufs_error (sb, "ufs_free_fragments", "internal error");
5555

5656
mutex_lock(&UFS_SB(sb)->s_lock);

0 commit comments

Comments
 (0)