[openbeosnetteam] Re: Another crash...

"Marcus Overhagen" <dos4gw@xxxxxx> wrote:

This one is wrong
>       int realsize = (size + 4 + B_PAGE_SIZE - 1) & B_PAGE_SIZE;
needs to be
int realsize = (size + 4 + B_PAGE_SIZE - 1) & ~(B_PAGE_SIZE - 1);

same with this one
>       char *staradr = ((char *)ptr - 4) & B_PAGE_SIZE;
char *staradr = ((char *)ptr - 4) & ~(B_PAGE_SIZE - 1);

Marcus

 

Other related posts: