more correct get_compat_timespec interface
PATCH 1/1 more correct get_compat_timespec interface
Hi Andrew,
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.
Joe
include/linux/compat.h +2 -2
@@ -44,8 +44,8 @@ } 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;
kernel/compat.c +2 -2
@@ -22,14 +22,14 @@#include <asm/uaccess.h> -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->tv_sec, &cts->tv_sec) ||__get_user (ts->tv_nsec, &cts->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->tv_sec, &cts->tv_sec) ||