From owner-svn-src-head@FreeBSD.ORG Sun Jan 10 07:18:53 2010 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 00452106566C; Sun, 10 Jan 2010 07:18:52 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail08.syd.optusnet.com.au (mail08.syd.optusnet.com.au [211.29.132.189]) by mx1.freebsd.org (Postfix) with ESMTP id 72E268FC19; Sun, 10 Jan 2010 07:18:52 +0000 (UTC) Received: from besplex.bde.org (c122-106-175-149.carlnfd1.nsw.optusnet.com.au [122.106.175.149]) by mail08.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o0A7ImEV004925 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 10 Jan 2010 18:18:49 +1100 Date: Sun, 10 Jan 2010 18:18:48 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Jaakko Heinonen In-Reply-To: <20100108214821.GA985@a91-153-117-195.elisa-laajakaista.fi> Message-ID: <20100110181132.D1354@besplex.bde.org> References: <201001080757.o087vhrr009799@svn.freebsd.org> <20100109051536.R57595@delplex.bde.org> <20100108214821.GA985@a91-153-117-195.elisa-laajakaista.fi> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Bruce Evans Subject: Re: svn commit: r201773 - head/sys/fs/tmpfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 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, 10 Jan 2010 07:18:53 -0000 On Fri, 8 Jan 2010, Jaakko Heinonen wrote: > Does following patch look reasonable? > > - Fix style bugs introduced in r201773. > - Change the type of nodes_max to u_int and use "%u" format string to > convert its value. > Index: sys/fs/tmpfs/tmpfs_vfsops.c > =================================================================== > --- sys/fs/tmpfs/tmpfs_vfsops.c (revision 201818) > +++ sys/fs/tmpfs/tmpfs_vfsops.c (working copy) > @@ -239,7 +239,7 @@ tmpfs_mount(struct mount *mp) > * allowed to use, based on the maximum size the user passed in > * the mount structure. A value of zero is treated as if the > * maximum available space was requested. */ > - if (size_max < PAGE_SIZE || size_max > (SIZE_MAX - PAGE_SIZE)) > + if (size_max < PAGE_SIZE || size_max > SIZE_MAX - PAGE_SIZE) > pages = SIZE_MAX; I think you should change this to use howmany() (or set size_max and join the else clause) too. > else > pages = howmany(size_max, PAGE_SIZE); OK. Gleb Kurtsou reported a more interesting problem related to large values of `pages' being too large. I'll let you look at this... IIRC he made the byte limit UINT_MAX. Perhaps it should be a small fraction of the address space (UINT_MAX is still larger than physically possible for 32-bit systems). Bruce