linux-mips
[Top] [All Lists]

[PATCH] MIPS: Mask sys_llseek offsets in 32-bit syscalls.

To: linux-mips@linux-mips.org, ralf@linux-mips.org
Subject: [PATCH] MIPS: Mask sys_llseek offsets in 32-bit syscalls.
From: David Daney <ddaney@caviumnetworks.com>
Date: Wed, 25 Mar 2009 10:01:44 -0700
Cc: David Daney <ddaney@caviumnetworks.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
The o32 user space ABI sign extends the offset values.  We need to
undo this by masking out the high bits.

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
---
 arch/mips/kernel/linux32.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index 49aac6e..13fc173 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -137,7 +137,8 @@ SYSCALL_DEFINE5(32_llseek, unsigned long, fd, unsigned 
long, offset_high,
        unsigned long, offset_low, loff_t __user *, result,
        unsigned long, origin)
 {
-       return sys_llseek(fd, offset_high, offset_low, result, origin);
+       return sys_llseek(fd, offset_high & 0xffffffff,
+                         offset_low & 0xffffffff, result, origin);
 }
 
 /* From the Single Unix Spec: pread & pwrite act like lseek to pos + op +
-- 
1.6.0.6


<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH] MIPS: Mask sys_llseek offsets in 32-bit syscalls., David Daney <=