[PATCH 2/2] powerpc: Fix mmap returning 64 bit addresses

Michael Ellerman michael at ellerman.id.au
Fri Oct 21 16:01:34 EST 2005


The merge of syscalls.c & sys_ppc32.c (30286ef6e044bc3d9019c3d8b900572e3fa05e65)
broke mmap, if the mmap returned a 64 bit address.

do_mmap2 was taking the return value from do_mmap_pgoff (an unsigned long), and
storing it in an int, before returning it to sys_mmap as an unsigned long. So
we were losing the high bits of the address.

You would have thought the compiler could catch this for us ...

Signed-off-by: Michael Ellerman <michael at ellerman.id.au>
---

 arch/powerpc/kernel/syscalls.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

Index: kexec/arch/powerpc/kernel/syscalls.c
===================================================================
--- kexec.orig/arch/powerpc/kernel/syscalls.c
+++ kexec/arch/powerpc/kernel/syscalls.c
@@ -162,7 +162,7 @@ static inline unsigned long do_mmap2(uns
 			unsigned long fd, unsigned long off, int shift)
 {
 	struct file * file = NULL;
-	int ret = -EINVAL;
+	unsigned long ret = -EINVAL;
 
 	if (shift) {
 		if (off & ((1 << shift) - 1))



More information about the Linuxppc64-dev mailing list