Skip to contentSkip to conversation

don't double >> PAGE_SHIFT pointer for /dev/kmem access

PATCH In review Jes Sorensen 3 participants 3 messages Oct 25, 2006 – Oct 26, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 don't double >> PAGE_SHIFT pointer for /dev/kmem access

Hi,

This one has been around for a while, but it's a pretty serious bug, so if you would push it upstream quickly that would be great. Thanks to Bjorn for spotting it.

Cheers,
Jes

Don't PAGE_SHIFT pointer before handing it to virt_to_page() in xlate_dev_kmem_ptr() as it results in a double shift.

Spotted by Bjorn 'Eagleeye' Helgaas.

---
 include/asm-ia64/uaccess.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6/include/asm-ia64/uaccess.h =================================--- linux-2.6.orig/include/asm-ia64/uaccess.h +++ linux-2.6/include/asm-ia64/uaccess.h
@@ -389,7 +389,7 @@ xlate_dev_kmem_ptr (char * p)
struct page *page;
char * ptr;

- page = virt_to_page((unsigned long)p >> PAGE_SHIFT);
+ page = virt_to_page((unsigned long)p);
if (PageUncached(page))
ptr = (char *)__pa(p) + __IA64_UNCACHED_OFFSET;
else

#1 lore raw
Quoted 3 lines · Jes Sorensen

This one has been around for a while, but it's a pretty serious bug, so if you would push it upstream quickly that would be great. Thanks to Bjorn for spotting it.

Bob Montgomery actually noticed it, so I can't take any credit for this :-)

#2 lore raw
In reply to Jes Sorensen
Quoted 3 lines

This one has been around for a while, but it's a pretty serious bug, so if you would push it upstream quickly that would be great. Thanks to Bjorn for spotting it.

I'll push it up to Linus tomorrow. Thanks for the reminder.

-Tony