Re: help can not mmap fffff000 - ffffffff using /dev/mem

Christian Zankel (chris@mvista.com)
Sat, 20 Nov 1999 13:38:45 -0800


david wrote:
>
> the bios is at this add and i need to read it
> but all i get from
> Base = 0xfffff000 ; size = 0x00001000 ;
> mem = mmap( NULL , size , PROT_READ | PROT_WRITE , MAP_SHARED , memfile
> , Base ) ;
> is errno = 22 Invalid argument
> thank you

If you look at do_mmap in mm/mmap.c you can see that your parameters
cause an overflow:

[...]
/* offset overflow? */
if (off + len < off)
return -EINVAL;
[...]

And it wouldn't even help you to change the size argument since the size
gets aligned to a page-size (0x1000) first:
[...]
if ((len = PAGE_ALIGN(len)) == 0)
return addr;
[...]

Maybe you try to change the expression above to:

if (off + len - 1 < off)
return -EINVAL;

Christian

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