Date: Sun, 03 Feb 2013 19:24:23 +0200 From: Andriy Gapon <avg@FreeBSD.org> To: Kirk McKusick <mckusick@FreeBSD.org> Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r246289 - head/sys/ufs/ffs Message-ID: <510E9D47.2030403@FreeBSD.org> In-Reply-To: <201302031716.r13HGXNP060303@svn.freebsd.org> References: <201302031716.r13HGXNP060303@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
on 03/02/2013 19:16 Kirk McKusick said the following: > Author: mckusick > Date: Sun Feb 3 17:16:32 2013 > New Revision: 246289 > URL: http://svnweb.freebsd.org/changeset/base/246289 > > Log: > 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 Just a note that clang actually warned about this one. It has a few more similar warnings for ufs/ffs code. > 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 > > Modified: > head/sys/ufs/ffs/ffs_inode.c > > Modified: head/sys/ufs/ffs/ffs_inode.c > ============================================================================== > --- head/sys/ufs/ffs/ffs_inode.c Sun Feb 3 15:54:57 2013 (r246288) > +++ head/sys/ufs/ffs/ffs_inode.c Sun Feb 3 17:16:32 2013 (r246289) > @@ -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 > -- Andriy Gapon
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?510E9D47.2030403>