From owner-svn-src-head@FreeBSD.ORG Mon May 12 20:35:58 2014 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 75AF3497; Mon, 12 May 2014 20:35:58 +0000 (UTC) Received: from gw.catspoiler.org (gw.catspoiler.org [75.1.14.242]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 56E792D43; Mon, 12 May 2014 20:35:58 +0000 (UTC) Received: from FreeBSD.org (mousie.catspoiler.org [192.168.101.2]) by gw.catspoiler.org (8.13.3/8.13.3) with ESMTP id s4CKZnv0076365; Mon, 12 May 2014 13:35:53 -0700 (PDT) (envelope-from truckman@FreeBSD.org) Message-Id: <201405122035.s4CKZnv0076365@gw.catspoiler.org> Date: Mon, 12 May 2014 13:35:49 -0700 (PDT) From: Don Lewis Subject: Re: svn commit: r265931 - head/sys/kern To: src-committers@FreeBSD.org In-Reply-To: <201405122022.s4CKMh8U037124@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18 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: Mon, 12 May 2014 20:35:58 -0000 On 12 May, To: src-committers@freebsd.org wrote: > Author: truckman > Date: Mon May 12 20:22:42 2014 > New Revision: 265931 > URL: http://svnweb.freebsd.org/changeset/base/265931 > > Log: > Be even more paranoid about overflow. > > Requested by: ache > > Modified: > head/sys/kern/subr_rman.c > > Modified: head/sys/kern/subr_rman.c > ============================================================================== > --- head/sys/kern/subr_rman.c Mon May 12 20:19:40 2014 (r265930) > +++ head/sys/kern/subr_rman.c Mon May 12 20:22:42 2014 (r265931) > @@ -466,8 +466,8 @@ rman_reserve_resource_bound(struct rman > } > > amask = (1ul << RF_ALIGNMENT(flags)) - 1; > - if (start + amask < start) { > - DPRINTF(("start+amask wrapped around\n")); > + if (start > ULONG_MAX - amask) { > + DPRINTF(("start+amask would wrap around\n")); > goto out; > } > > @@ -487,8 +487,8 @@ rman_reserve_resource_bound(struct rman > s->r_start, end)); > break; > } > - if (s->r_start + amask < s->r_start) { > - DPRINTF(("s->r_start (%#lx) + amask (%#lx) wrapped\n", > + if (s->r_start > ULONG_MAX - amask) { > + DPRINTF(("s->r_start (%#lx) + amask (%#lx) too large\n", > s->r_start, amask)); > break; > } > MFC after: 1 week