From owner-freebsd-audit Sat Aug 4 11:25:12 2001 Delivered-To: freebsd-audit@freebsd.org Received: from coffee.q9media.com (coffee.q9media.com [216.94.229.19]) by hub.freebsd.org (Postfix) with ESMTP id 737FD37B401 for ; Sat, 4 Aug 2001 11:25:07 -0700 (PDT) (envelope-from mike@coffee.q9media.com) Received: (from mike@localhost) by coffee.q9media.com (8.11.2/8.11.2) id f74IidR08172; Sat, 4 Aug 2001 14:44:39 -0400 (EDT) (envelope-from mike) Date: Sat, 4 Aug 2001 14:44:39 -0400 From: Mike Barcroft To: Bruce Evans Cc: audit@FreeBSD.org Subject: Re: cmp(1) warns patch Message-ID: <20010804144439.A8069@coffee.q9media.com> References: <20010803213745.A4390@coffee.q9media.com> <20010804124551.S16377-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: <20010804124551.S16377-100000@besplex.bde.org>; from bde@zeta.org.au on Sat, Aug 04, 2001 at 12:59:56PM +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 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. > > Casting the left hand size to the type of the right hand side would be > even more broken. > > Without any casts, `length' and SIZE_T_MAX were promoted to a common > type and there was no problem unless length < 0 (which can't happen). 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? Best regards, Mike Barcroft To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message