diff options
author | Kirk McKusick <mckusick@FreeBSD.org> | 2013-02-03 17:16:32 +0000 |
---|---|---|
committer | Kirk McKusick <mckusick@FreeBSD.org> | 2013-02-03 17:16:32 +0000 |
commit | fe85d98a5b5d090eb1eb71bda9c00e25b5e30a0c (patch) | |
tree | bb4b13cc083564b15f377af4a98da39c1467af45 /sys/ufs | |
parent | 4dc6bdd3e7e670c195cd66b9319b4059f572cdfc (diff) | |
download | src-fe85d98a5b5d090eb1eb71bda9c00e25b5e30a0c.tar.gz src-fe85d98a5b5d090eb1eb71bda9c00e25b5e30a0c.zip |
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
Notes
Notes:
svn path=/head/; revision=246289
Diffstat (limited to 'sys/ufs')
-rw-r--r-- | sys/ufs/ffs/ffs_inode.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c index f8584d539545..4571a1cdc92b 100644 --- a/sys/ufs/ffs/ffs_inode.c +++ b/sys/ufs/ffs/ffs_inode.c @@ -546,9 +546,9 @@ done: */ ip->i_size = length; DIP_SET(ip, i_size, length); - DIP_SET(ip, i_blocks, DIP(ip, i_blocks) - blocksreleased); - - if (DIP(ip, i_blocks) < 0) /* sanity */ + if (DIP(ip, i_blocks) >= blocksreleased) + DIP_SET(ip, i_blocks, DIP(ip, i_blocks) - blocksreleased); + else /* sanity */ DIP_SET(ip, i_blocks, 0); ip->i_flag |= IN_CHANGE; #ifdef QUOTA |