lkml.org 
[lkml]   [1998]   [Jul]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Bug in ioremap: boundary case is wrong


On Sun, 26 Jul 1998, Alan Cox wrote:

> The x86 ioremap starts with
>
> if(phys_addr > virt_to_phys(high_memory))
> return phys_to_virt(phys_addr);
>
> If you vremap an area whose end point is over the high_memory point your
> memory mapping breaks. Surely it should be
>
> if( phys_addr + size > ...)

Hmm.. It would actually be a _major_ bug if somebody were to try to
ioremap the normal RAM range, so anybody even trying to do the above would
be so buggy that it makes absolutely no difference.

The most correct test would probably be something like

/*
* The 640kB - 1MB hole does not need any remapping,
* it's always mapped in kernel memory already. Just
* do the phys->virt translation on it.
*/
if (phys_addr >= 640*1024 && phys_addr+size <= 1<<20)
return phys_to_virt(phys_addr);
/*
* Anybody trying to use real RAM for io mappings?
* That would be BAD.
*/
if (phys_addr < virt_to_phys(high_memory))
return NULL;
/*
* remap the IO memory through the page tables
*/
....
which is clearer than the current code anyway.

Linus


-
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.altern.org/andrebalsa/doc/lkml-faq.html

\
 
 \ /
  Last update: 2005-03-22 13:43    [from the cache]
©2003-2011 Jasper Spaans