Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

On CONFIG_64BIT_PHYS_ADDR, pfn always fits in 'unsigned long', but pfn<<PAGE_SHIFT sometimes extends beyond. The pte is big enough to hold 'long long', but the shift in pfn_pte() needs to do its calculation with enough bits to hold the result.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

+1 -1
+1 -1
include/asm-mips/pgtable-32.h
··· 137 137 #define pfn_pte(pfn, prot) __pte(((pfn) << (PAGE_SHIFT + 2)) | pgprot_val(prot)) 138 138 #else 139 139 #define pte_pfn(x) ((unsigned long)((x).pte >> PAGE_SHIFT)) 140 - #define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) 140 + #define pfn_pte(pfn, prot) __pte(((unsigned long long)(pfn) << PAGE_SHIFT) | pgprot_val(prot)) 141 141 #endif 142 142 #endif /* defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1) */ 143 143