From owner-freebsd-audit Fri Sep 14 8:56:23 2001 Delivered-To: freebsd-audit@freebsd.org Received: from whale.sunbay.crimea.ua (whale.sunbay.crimea.ua [212.110.138.65]) by hub.freebsd.org (Postfix) with ESMTP id B6DF837B40D; Fri, 14 Sep 2001 08:55:33 -0700 (PDT) Received: (from ru@localhost) by whale.sunbay.crimea.ua (8.11.2/8.11.2) id f8EFro955889; Fri, 14 Sep 2001 18:53:50 +0300 (EEST) (envelope-from ru) Date: Fri, 14 Sep 2001 18:53:50 +0300 From: Ruslan Ermilov To: Bruce Evans Cc: Mike Barcroft , audit@FreeBSD.ORG Subject: Re: cmp(1) warns patch Message-ID: <20010914185350.B52001@sunbay.com> References: <20010804144439.A8069@coffee.q9media.com> <20010805235106.Y27651-100000@besplex.bde.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010805235106.Y27651-100000@besplex.bde.org>; from bde@zeta.org.au on Mon, Aug 06, 2001 at 12:16:56AM +1000 Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Mon, Aug 06, 2001 at 12:16:56AM +1000, Bruce Evans wrote: > On Sat, 4 Aug 2001, Mike Barcroft wrote: > > > On Sat, Aug 04, 2001 at 12:59:56PM +1000, Bruce Evans wrote: > > > On Fri, 3 Aug 2001, Mike Barcroft wrote: > > > > ... > > > > Index: cmp/regular.c > > > > =================================================================== > > > > RCS file: /home/ncvs/src/usr.bin/cmp/regular.c,v > > > > retrieving revision 1.10 > > > > diff -u -r1.10 regular.c > > > > --- cmp/regular.c 2000/06/20 20:28:40 1.10 > > > > +++ cmp/regular.c 2001/08/04 01:02:33 > > > > ... > > > > @@ -81,7 +81,7 @@ > > > > off2 = ROUNDPAGE(skip2); > > > > > > > > length = MIN(len1, len2); > > > > - if (length > SIZE_T_MAX) > > > > + if (length > (off_t)SIZE_T_MAX) > > > > > > This is broken on many machines, including alphas. On alphas, > > > (off_t)SIZE_MAX overflows to -1, so `length' is always larger and the > > > pessimized cspecial() method is always used. > > ... > > I guess I should have looked at the types a little more closely. Do > > you have any suggestions for overcoming the comparison between signed > > and unsigned warning on alpha? > > None very good. In general, the signed type must be promoted to a suitable > unsigned type, but to do that you have to know too much about the signed > type if that type is a typedefed type. Here we can't do anything better > than promote to "unsigned long long". This assumes that "unsigned long > long" can represent all possible file sizes. In the kernel, we could use > uoff_t. I introduced uoff_t because promoting off_t's to an unsigned type > is useful in other contexts. > It would be great if we had the "largest [un]signed int type" typedef'ed somehow to make such conversions possible. Cheers, -- Ruslan Ermilov Oracle Developer/DBA, ru@sunbay.com Sunbay Software AG, ru@FreeBSD.org FreeBSD committer, +380.652.512.251 Simferopol, Ukraine http://www.FreeBSD.org The Power To Serve http://www.oracle.com Enabling The Information Age To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message