Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 02 Aug 2002 17:46:08 -0700
From:      Peter Wemm <peter@wemm.org>
To:        Dominic Marks <dominic_marks@btinternet.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: very minor vm_map.c typo ? 
Message-ID:  <20020803004608.678652A7D6@canning.wemm.org>
In-Reply-To: <3D4B1755.1030301@btinternet.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020803004608.678652A7D6>