<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">
From: Joe Korty &lt;joe.korty@ccur.com&gt;

The API for get_compat_timespec / put_compat_timespec is incorrect, it
forces a caller with const args to (incorrectly) cast.  The posix message
queue patch is one such caller.



 include/linux/compat.h |    4 ++--
 kernel/compat.c        |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff -puN include/linux/compat.h~compat_timespec-cleanup include/linux/compat.h
--- 25/include/linux/compat.h~compat_timespec-cleanup	2003-12-14 17:40:39.000000000 -0800
+++ 25-akpm/include/linux/compat.h	2003-12-14 17:40:39.000000000 -0800
@@ -44,8 +44,8 @@ typedef struct {
 } compat_sigset_t;
 
 extern int cp_compat_stat(struct kstat *, struct compat_stat *);
-extern int get_compat_timespec(struct timespec *, struct compat_timespec *);
-extern int put_compat_timespec(struct timespec *, struct compat_timespec *);
+extern int get_compat_timespec(struct timespec *, const struct compat_timespec *);
+extern int put_compat_timespec(struct timespec *, const struct compat_timespec *);
 
 struct compat_iovec {
 	compat_uptr_t	iov_base;
diff -puN kernel/compat.c~compat_timespec-cleanup kernel/compat.c
--- 25/kernel/compat.c~compat_timespec-cleanup	2003-12-14 17:40:39.000000000 -0800
+++ 25-akpm/kernel/compat.c	2003-12-14 17:40:39.000000000 -0800
@@ -22,14 +22,14 @@
 
 #include &lt;asm/uaccess.h&gt;
 
-int get_compat_timespec(struct timespec *ts, struct compat_timespec *cts)
+int get_compat_timespec(struct timespec *ts, const struct compat_timespec *cts)
 {
 	return (verify_area(VERIFY_READ, cts, sizeof(*cts)) ||
 			__get_user(ts-&gt;tv_sec, &amp;cts-&gt;tv_sec) ||
 			__get_user(ts-&gt;tv_nsec, &amp;cts-&gt;tv_nsec)) ? -EFAULT : 0;
 }
 
-int put_compat_timespec(struct timespec *ts, struct compat_timespec *cts)
+int put_compat_timespec(struct timespec *ts, const struct compat_timespec *cts)
 {
 	return (verify_area(VERIFY_WRITE, cts, sizeof(*cts)) ||
 			__put_user(ts-&gt;tv_sec, &amp;cts-&gt;tv_sec) ||

_
</pre></body></html>