For UFS2 i_blocks is unsigned. The current "sanity" check that it
has gone below zero after the blocks in its inode are freed is a no-op which the compiler fails to warn about because of the use of the DIP macro. Change the sanity check to compare the number of blocks being freed against the value i_blocks. If the number of blocks being freed exceeds i_blocks, just set i_blocks to zero. Reported by: Pedro Giffuni (pfg@) MFC after: 2 weeks
This commit is contained in:
parent
4dc6bdd3e7
commit
fe85d98a5b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=246289
@ -546,9 +546,9 @@ ffs_truncate(vp, length, flags, cred)
|
||||
*/
|
||||
ip->i_size = length;
|
||||
DIP_SET(ip, i_size, length);
|
||||
if (DIP(ip, i_blocks) >= blocksreleased)
|
||||
DIP_SET(ip, i_blocks, DIP(ip, i_blocks) - blocksreleased);
|
||||
|
||||
if (DIP(ip, i_blocks) < 0) /* sanity */
|
||||
else /* sanity */
|
||||
DIP_SET(ip, i_blocks, 0);
|
||||
ip->i_flag |= IN_CHANGE;
|
||||
#ifdef QUOTA
|
||||
|
Loading…
Reference in New Issue
Block a user