Skip to contentSkip to conversation

compat_clock_getres shouldn't return -EFAULT if res == NULL

PATCH Arun Sharma 3 participants 3 messages Jul 26, 2004 Generic include/asm header files

lore
Share & tools
lore
#0 lore raw

Description within the patch.

-Arun

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().

kernel/compat.c renamed from kernel/compat.c.orig +1 -1
@@ -531,7 +531,7 @@
 	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;
 } 
#2 lore raw
Quoted 7 lines · David S. Miller
Quoted 1 line · On Mon, 26 Jul 2004 12:51:29 -0700 Arun Sharma <[email protected]> wrote:

Description within the patch.

Looks good.

I'll queue it up. I seem to have ~200 patches to deal with, mostly non-trivial :(