Skip to contentSkip to conversation

sparc64: Fix range check in kern_addr_valid().

PATCH Superseded David Miller 2 participants 3 messages Apr 30, 2014 – May 2, 2014 SPARC + UltraSPARC (sparc/sparc64)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

David Miller

author maintainer
#0 lore raw

PATCH 8/10 sparc64: Fix range check in kern_addr_valid().

In commit b2d438348024b75a1ee8b66b85d77f569a5dfed8 ("sparc64: Make PAGE_OFFSET variable."), the MAX_PHYS_ADDRESS_BITS value was increased (to 47).

This constant reference to '41UL' was missed.

---
 arch/sparc/include/asm/pgtable_64.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/sparc/include/asm/pgtable_64.h +1 -1
index ac5f708..ff97960 100644
@@ -916,7 +916,7 @@ static inline bool kern_addr_valid(unsigned long addr)
 {
 	unsigned long paddr = __pa(addr);
 
-	if ((paddr >> 41UL) != 0UL)
+	if ((paddr >> MAX_PHYS_ADDRESS_BITS) != 0UL)
 		return false;
 	return test_bit(paddr >> 22, sparc64_valid_addr_bitmap);
 }
Signature · 1 line
1.8.1.2
#1 lore raw

arch/sparc/include/asm/pgtable_64.h static inline bool kern_addr_valid(unsigned long addr) · line 921

Quoted 10 lines · David Miller
arch/sparc/include/asm/pgtable_64.h +1 -1
@@ -916,7 +916,7 @@ static inline bool kern_addr_valid(unsigned long addr)
 {
 	unsigned long paddr = __pa(addr);
 
-	if ((paddr >> 41UL) != 0UL)
+	if ((paddr >> MAX_PHYS_ADDRESS_BITS) != 0UL)
 		return false;
 	return test_bit(paddr >> 22, sparc64_valid_addr_bitmap);

BTW, maybe this other magic constant - 22 - could be replaced as well? Is that ILOG2_4MB?

Signature · 1 line
     2. That which causes joy or happiness.
author maintainer
#2 lore raw
In reply to David Miller

From: Josip Rodin <[email protected]>
Date: Fri, 2 May 2014 00:42:25 +0200

Quoted 7 lines · David Miller
Quoted 6 lines
arch/sparc/include/asm/pgtable_64.h +0 -0
@@ -916,7 +916,7 @@ static inline bool kern_addr_valid(unsigned long addr)
 {
 	unsigned long paddr = __pa(addr);
 
Quoted 7 lines

arch/sparc/include/asm/pgtable_64.h static inline bool kern_addr_valid(unsigned long addr) · line 921

Quoted 4 lines
arch/sparc/include/asm/pgtable_64.h +1 -1
-	if ((paddr >> 41UL) != 0UL)
+	if ((paddr >> MAX_PHYS_ADDRESS_BITS) != 0UL)
 		return false;
 	return test_bit(paddr >> 22, sparc64_valid_addr_bitmap);

BTW, maybe this other magic constant - 22 - could be replaced as well? Is that ILOG2_4MB?

Yep, it is.