lkml.org 
[lkml]   [2009]   [Jul]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] dma-debug: Fix the overlap() function to be correct and readable

* Linus Torvalds <torvalds@linux-foundation.org> wrote:

>
>
> On Fri, 10 Jul 2009, Ingo Molnar wrote:
> >
> > How about the patch below? Lightly tested.
> >
> > if (!PageHighMem(page)) {
> > - void *addr = ((char *)page_address(page)) + offset;
> > + void *addr = (void *)page_address(page) + offset;
> > +
>
> Why is that 'void *' cast there? page_address() is already a void *.
>
> Other than that it obviously looks good to me. But I never see my
> own bugs.

hm, indeed. I distinctly remember page_address() having been
unsigned long ten years ago.

And yes, i still have a "highmem-2.2.21-A0" patch proving it:

--- linux/include/linux/pagemap.h.orig Thu Oct 7 14:54:24 1999
+++ linux/include/linux/pagemap.h Wed Oct 13 02:44:03 1999
@@ -11,12 +11,24 @@

#include <linux/mm.h>
#include <linux/fs.h>
+#include <linux/list.h>

-static inline unsigned long page_address(struct page * page)
+extern inline unsigned long FIXME_page_address(struct page * page)
{
+ if (PageHIGHMEM(page))
+ BUG();
return PAGE_OFFSET + ((page - mem_map) << PAGE_SHIFT);

Which, beyond being a rather embarrasing hunk (whose author i wont
name voluntarily - i'll rather take the 5th), also shows that
page_address() started out as an unsigned long.

Which got cleaned up for good once we added page->address, instead
of the above direct calculation.

( Note to self: consider checking the types of core MM facilities
somewhat more frequently than every 10 years. )

Ingo

\
 
 \ /
  Last update: 2009-07-10 22:37    [W:0.072 / U:1.944 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site