From 09e77fcaff727d2454d1350330920184e9c8e65b Mon Sep 17 00:00:00 2001 From: Arun Sharma Date: Wed, 28 Jul 2004 08:57:26 -0700 Subject: [PATCH] compat_clock_getres shouldn't return -EFAULT if res == NULL For clock_getres(clockid_t clock_id, struct timespec *res), the specification says "If res is NULL, the clock resolution is not returned." So this kind of call should succeed. The current implementation returns -EFAULT. The patch fixes the bug in compat_clock_getres(). Signed-off-by: Gordon Jin Signed-off-by: Arun Sharma Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- kernel/compat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'kernel') diff --git a/kernel/compat.c b/kernel/compat.c index 57cc48e90361..481ac0d4bb98 100644 --- a/kernel/compat.c +++ b/kernel/compat.c @@ -531,7 +531,7 @@ long compat_clock_getres(clockid_t which_clock, err = sys_clock_getres(which_clock, (struct timespec __user *) &ts); set_fs(oldfs); - if (!err && put_compat_timespec(&ts, tp)) + if (!err && tp && put_compat_timespec(&ts, tp)) return -EFAULT; return err; } -- cgit v1.2.3