Commit 09e77fca authored by Arun Sharma's avatar Arun Sharma Committed by Linus Torvalds

[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: default avatarGordon Jin <gordon.jin@intel.com>
Signed-off-by: default avatarArun Sharma <arun.sharma@intel.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 396af5c1
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment