* failure in /mm/memory.c
@ 2004-10-16 11:32 christophpfister
2004-10-16 12:09 ` William Lee Irwin III
0 siblings, 1 reply; 4+ messages in thread
From: christophpfister @ 2004-10-16 11:32 UTC (permalink / raw)
To: linux-kernel
hello
i found a failure in function remap_pte_range in memory.c
static inline void remap_pte_range(...)
{
unsigned long end;
unsigned long pfn;
address &= ~PMD_MASK;
end = address + size;
if (end > PMD_SIZE)
end = PMD_SIZE;
pfn = phys_addr >> PAGE_SHIFT;
do {
BUG_ON(!pte_none(*pte));
if (!pfn_valid(pfn) || PageReserved(pfn_to_page(pfn))) *****
set_pte(pte, pfn_pte(pfn, prot));
address += PAGE_SIZE;
pfn++;
pte++;
} while (address && (address < end));
}
by ****
the condition is wrong, because it just maps the page, if it's invalid or
reserved
correct: if (!(pfn_valid(pfn) || PageReserved(pfn_to_page(pfn))))
(it doesn't seems to be used, otherwise there must be bugs)
Yours sincerely,
Christoph Pfister
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: failure in /mm/memory.c
2004-10-16 11:32 failure in /mm/memory.c christophpfister
@ 2004-10-16 12:09 ` William Lee Irwin III
2004-10-17 2:33 ` Alan Cox
0 siblings, 1 reply; 4+ messages in thread
From: William Lee Irwin III @ 2004-10-16 12:09 UTC (permalink / raw)
To: christophpfister; +Cc: linux-kernel
On Sat, Oct 16, 2004 at 12:32:35PM +0100, christophpfister@bluemail.ch wrote:
> i found a failure in function remap_pte_range in memory.c
> static inline void remap_pte_range(...)
> {
> unsigned long end;
> unsigned long pfn;
> address &= ~PMD_MASK;
> end = address + size;
> if (end > PMD_SIZE)
> end = PMD_SIZE;
> pfn = phys_addr >> PAGE_SHIFT;
> do {
> BUG_ON(!pte_none(*pte));
> if (!pfn_valid(pfn) || PageReserved(pfn_to_page(pfn))) *****
> set_pte(pte, pfn_pte(pfn, prot));
> address += PAGE_SIZE;
> pfn++;
> pte++;
> } while (address && (address < end));
> }
Well, there are issues...
On Sat, Oct 16, 2004 at 12:32:35PM +0100, christophpfister@bluemail.ch wrote:
> by ****
> the condition is wrong, because it just maps the page, if it's invalid or
> reserved
> correct: if (!(pfn_valid(pfn) || PageReserved(pfn_to_page(pfn))))
> (it doesn't seems to be used, otherwise there must be bugs)
This isn't one of them. De Morgan teach us that what you wrote is just
!pfn_valid(pfn) && !PageReserved(pfn_to_page(pfn))
which would evaluate pfn_to_page() on an invalid pfn, and so nonsensical.
-- wli
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: failure in /mm/memory.c
2004-10-16 12:09 ` William Lee Irwin III
@ 2004-10-17 2:33 ` Alan Cox
2004-10-17 3:40 ` William Lee Irwin III
0 siblings, 1 reply; 4+ messages in thread
From: Alan Cox @ 2004-10-17 2:33 UTC (permalink / raw)
To: William Lee Irwin III; +Cc: christophpfister, Linux Kernel Mailing List
On Sad, 2004-10-16 at 13:09, William Lee Irwin III wrote:
> On Sat, Oct 16, 2004 at 12:32:35PM +0100, christophpfister@bluemail.ch wrote:
> > i found a failure in function remap_pte_range in memory.c
I think the bug is in the comment not the code !
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: failure in /mm/memory.c
2004-10-17 2:33 ` Alan Cox
@ 2004-10-17 3:40 ` William Lee Irwin III
0 siblings, 0 replies; 4+ messages in thread
From: William Lee Irwin III @ 2004-10-17 3:40 UTC (permalink / raw)
To: Alan Cox; +Cc: christophpfister, Linux Kernel Mailing List
On Sat, Oct 16, 2004 at 12:32:35PM +0100, christophpfister@bluemail.ch wrote:
>>> i found a failure in function remap_pte_range in memory.c
On Sad, 2004-10-16 at 13:09, William Lee Irwin III wrote:
[...]
On Sun, Oct 17, 2004 at 03:33:39AM +0100, Alan Cox wrote:
> I think the bug is in the comment not the code !
I suppose the comment is a bit off, sure. I'll send an update atop the
remap_pfn_range() patch series akpm has in -mm to correct it.
-- wli
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-10-17 3:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-16 11:32 failure in /mm/memory.c christophpfister
2004-10-16 12:09 ` William Lee Irwin III
2004-10-17 2:33 ` Alan Cox
2004-10-17 3:40 ` William Lee Irwin III
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.