From owner-svn-src-head@FreeBSD.ORG Sun Feb 3 17:24:27 2013 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 45B01DD6; Sun, 3 Feb 2013 17:24:27 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id E85101F1; Sun, 3 Feb 2013 17:24:25 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id TAA09423; Sun, 03 Feb 2013 19:24:24 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1U23Im-0006nL-86; Sun, 03 Feb 2013 19:24:24 +0200 Message-ID: <510E9D47.2030403@FreeBSD.org> Date: Sun, 03 Feb 2013 19:24:23 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130121 Thunderbird/17.0.2 MIME-Version: 1.0 To: Kirk McKusick Subject: Re: svn commit: r246289 - head/sys/ufs/ffs References: <201302031716.r13HGXNP060303@svn.freebsd.org> In-Reply-To: <201302031716.r13HGXNP060303@svn.freebsd.org> X-Enigmail-Version: 1.4.6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Feb 2013 17:24:27 -0000 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