lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090710203404.GA4234@elte.hu>
Date:	Fri, 10 Jul 2009 22:34:04 +0200
From:	Ingo Molnar <mingo@...e.hu>
To:	Linus Torvalds <torvalds@...ux-foundation.org>
Cc:	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Joerg Roedel <joerg.roedel@....com>
Subject: Re: [PATCH] dma-debug: Fix the overlap() function to be correct
	and readable


* Linus Torvalds <torvalds@...ux-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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ