Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110806153826.GW29562@port70.net>
Date: Sat, 6 Aug 2011 17:38:26 +0200
From: Szabolcs Nagy <nsz@...t70.net>
To: musl@...ts.openwall.com
Subject: Re: New daily reports - debugging alloc.c et al

* Szabolcs Nagy <nsz@...t70.net> [2011-08-06 16:34:33 +0200]:
> 	for (i=j=SIZE_MAX/2; i>0; i/=2) {
> 		if ((*p=mmap(NULL, j, PROT_NONE, MAP_PRIVATE, fd, 0)) == MAP_FAILED)
> 			j -= i/2;
> 		else {

i've just realized that

  for (i=j=SIZE_MAX/2+1; i>=PAGE_SIZE; i/=2) {

is better

(if j is not initialized to a power of 2 then i/=2
does not do proper binary search)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.