lkml.org 
[lkml]   [2001]   [Nov]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] mmap + wrapping around to 0
PAGE_ALIGN results in a multiple of PAGE_SIZE always.
If you subtract one inside, the end result will
be the same.

As an example:
map 0x1000 bytes at 0xfffff000
PAGE_ALIGN(0x1000) = 0x1000
PAGE_ALIGN(0x0fff) = 0x1000
PAGE_ALIGN(0x1000)-1 = 0x0fff
The difference is adding 0x1000 or 0xfff to
0xfffff000, and the result wrapping around
to 0, or going to 0xffffffff (the later
result is what we want and the comparison works).

-Dave

On Thu, 8 Nov 2001, Alan Cox wrote:

> > in the inline function do_mmap(), change
> > if ((offset + PAGE_ALIGN(len)) < offset)
> > to
> > if ((offset + PAGE_ALIGN(len)-1) < offset)
>
> Shouldnt that be
>
> PAGE_ALIGN(len-1)
>
> so you compute the page of the last byte ?
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:13    [W:0.050 / U:1.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site