[PATCH] powerpc: change rheap functions to use long integers instead of pointers

Scott Wood scottwood at freescale.com
Thu Apr 5 04:31:59 EST 2007


Timur Tabi wrote:
> Scott Wood wrote:
> 
>>> The same patch should be applied to rh_detach_region() and 
>>> rh_alloc_fixed().
>>
>>
>> You should check "e" instead, and make sure that s < e.
> 
> 
> Now that I look at the code, I think there's a bug in the calculation of 
> 'e'.  'e' is rounded down, and it's based on the unaligned value of 
> 'start'.  Instead, 'size' should be rounded up, and 'e' should be based 
> on 's' (i.e. the aligned value of 'start').
> 
> Otherwise, if you pass an unaligned value of 'start', then the buffer 
> you get back will be less than 'size'.

That's better than the buffer you get back being bigger than the region 
that's really free...

If I attach a region from 0x03 to 0x2d, and the alignment is 4, then the 
only sane thing to do is allocate from 0x04 to 0x2b.

-Scott



More information about the Linuxppc-dev mailing list