summaryrefslogtreecommitdiff
path: root/arch/powerpc/kernel/vdso32
diff options
context:
space:
mode:
authorTony Breeds <tony@bakeyournoodle.com>2007-06-26 03:50:32 +0400
committerPaul Mackerras <paulus@samba.org>2007-06-26 08:41:19 +0400
commit74609f4536f2b8fd6a48381bbbe3cd37da20a527 (patch)
treef73c0abf05df85497b0323290e6cfff948a7fadd /arch/powerpc/kernel/vdso32
parentca74c013441200b162f6a384b23b833d1865a9e8 (diff)
downloadlinux-74609f4536f2b8fd6a48381bbbe3cd37da20a527.tar.xz
[POWERPC] Fix VDSO gettimeofday() when called with NULL struct timeval
Consider the prototype for gettimeofday(): int gettimofday(struct timeval *tv, struct timezone *tz); Although it is valid to call with /either/ tv or tz being NULL, and the C version of sys_gettimeofday() supports this, the current version of gettimeofday() in the VDSO will SEGV if called with a NULL tv. This adds a check for tv being NULL so that it doesn't SEGV. Signed-off-by: Tony Breeds <tony@bakeyournoodle.com> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel/vdso32')
-rw-r--r--arch/powerpc/kernel/vdso32/gettimeofday.S4
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/powerpc/kernel/vdso32/gettimeofday.S b/arch/powerpc/kernel/vdso32/gettimeofday.S
index 05909f754307..72ca26df457e 100644
--- a/arch/powerpc/kernel/vdso32/gettimeofday.S
+++ b/arch/powerpc/kernel/vdso32/gettimeofday.S
@@ -32,6 +32,8 @@ V_FUNCTION_BEGIN(__kernel_gettimeofday)
mr r11,r4 /* r11 saves tz */
bl __get_datapage@local /* get data page */
mr r9, r3 /* datapage ptr in r9 */
+ cmplwi r10,0 /* check if tv is NULL */
+ beq 3f
bl __do_get_xsec@local /* get xsec from tb & kernel */
bne- 2f /* out of line -> do syscall */
@@ -50,7 +52,7 @@ V_FUNCTION_BEGIN(__kernel_gettimeofday)
mulhwu r5,r5,r6
stw r5,TVAL32_TV_USEC(r10)
- cmpli cr0,r11,0 /* check if tz is NULL */
+3: cmplwi r11,0 /* check if tz is NULL */
beq 1f
lwz r4,CFG_TZ_MINUTEWEST(r9)/* fill tz */
lwz r5,CFG_TZ_DSTTIME(r9)