From owner-svn-src-head@FreeBSD.ORG Tue Jan 18 17:00:47 2011 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 E8E8A106566B; Tue, 18 Jan 2011 17:00:47 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail09.syd.optusnet.com.au (mail09.syd.optusnet.com.au [211.29.132.190]) by mx1.freebsd.org (Postfix) with ESMTP id 859058FC1A; Tue, 18 Jan 2011 17:00:47 +0000 (UTC) Received: from c122-106-165-206.carlnfd1.nsw.optusnet.com.au (c122-106-165-206.carlnfd1.nsw.optusnet.com.au [122.106.165.206]) by mail09.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p0IH0ibu023684 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 19 Jan 2011 04:00:45 +1100 Date: Wed, 19 Jan 2011 04:00:44 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: John Baldwin In-Reply-To: <201101181523.p0IFNGeB042079@svn.freebsd.org> Message-ID: <20110119035030.W2099@besplex.bde.org> References: <201101181523.p0IFNGeB042079@svn.freebsd.org> 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 Subject: Re: svn commit: r217538 - in head/sys/dev: buslogic cs 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: Tue, 18 Jan 2011 17:00:48 -0000 On Tue, 18 Jan 2011, John Baldwin wrote: > Log: > Remove some always-true comparisons. > > Submitted by: clang via rdivacky > > Modified: head/sys/dev/buslogic/bt.c > ============================================================================== > --- head/sys/dev/buslogic/bt.c Tue Jan 18 14:58:44 2011 (r217537) > +++ head/sys/dev/buslogic/bt.c Tue Jan 18 15:23:16 2011 (r217538) > @@ -975,7 +975,7 @@ bt_find_probe_range(int ioport, int *por > int > bt_iop_from_bio(isa_compat_io_t bio_index) > { > - if (bio_index >= 0 && bio_index < BT_NUM_ISAPORTS) > + if (bio_index < BT_NUM_ISAPORTS) > return (bt_board_ports[bio_index]); > return (-1); > } So, what guarantees that isa_compat_io_t is unsigned and will remain so? Indexes should be ints, unless you want a sign morass. > Modified: head/sys/dev/cs/if_cs.c > ============================================================================== > --- head/sys/dev/cs/if_cs.c Tue Jan 18 14:58:44 2011 (r217537) > +++ head/sys/dev/cs/if_cs.c Tue Jan 18 15:23:16 2011 (r217538) > @@ -364,7 +364,7 @@ cs_cs89x0_probe(device_t dev) > > if (!error && !(sc->flags & CS_NO_IRQ)) { > if (chip_type == CS8900) { > - if (irq >= 0 || irq < 16) > + if (irq < 16) > irq = cs8900_irq2eeint[irq]; > else > irq = 255; > Here `irq' is declared locally as u_long, so it can easily seen to be unsigned. u_long is bogus, but is unfortunately required by bus_get_resource()' API to fetch the initial value of `irq'. The irq is only checked to be in range and even bus_get_resource()'s return value are not checked until long after the call. Bruce