From owner-freebsd-hackers Fri Aug 2 17:46:15 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6586037B401 for ; Fri, 2 Aug 2002 17:46:12 -0700 (PDT) Received: from canning.wemm.org (canning.wemm.org [192.203.228.65]) by mx1.FreeBSD.org (Postfix) with ESMTP id E5DF243E4A for ; Fri, 2 Aug 2002 17:46:08 -0700 (PDT) (envelope-from peter@wemm.org) Received: from wemm.org (localhost [127.0.0.1]) by canning.wemm.org (Postfix) with ESMTP id 678652A7D6; Fri, 2 Aug 2002 17:46:08 -0700 (PDT) (envelope-from peter@wemm.org) X-Mailer: exmh version 2.5 07/13/2001 with nmh-1.0.4 To: Dominic Marks Cc: freebsd-hackers@freebsd.org Subject: Re: very minor vm_map.c typo ? In-Reply-To: <3D4B1755.1030301@btinternet.com> Date: Fri, 02 Aug 2002 17:46:08 -0700 From: Peter Wemm Message-Id: <20020803004608.678652A7D6@canning.wemm.org> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Dominic Marks wrote: > Hello, > > In vm_map.c, in the vm_map_insert(...) function there is the following > piece of code which checks if the addresses supplied to the function are > valid: > > ** > if ((start < map->min_offset) || (end > map->max_offset) || > (start >= end)) > return (KERN_INVALID_ADDRESS); > ** > > Specifically, I am interested in the final comparison. Is it possible > that start == end could ever be correct? Do zero sized entries ever get > inserted? (I don't see why you would ever wish to do this, please > explain it to me if there is a reason). That would most likely be a case of defensive programming, especially in case of a sign wraparound problem or the like. No, inserting a zero-length map entry isn't valid and the defensive case comes for free. Cheers, -Peter -- Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com "All of this is for nothing if we don't go to the stars" - JMS/B5 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message