Commit 0eea2040 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] more correct get_compat_timespec interface

From: Joe Korty <joe.korty@ccur.com>

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.
parent 0f4e98bc
...@@ -44,8 +44,8 @@ typedef struct { ...@@ -44,8 +44,8 @@ typedef struct {
} compat_sigset_t; } compat_sigset_t;
extern int cp_compat_stat(struct kstat *, struct compat_stat *); extern int cp_compat_stat(struct kstat *, struct compat_stat *);
extern int get_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 *, struct compat_timespec *); extern int put_compat_timespec(struct timespec *, const struct compat_timespec *);
struct compat_iovec { struct compat_iovec {
compat_uptr_t iov_base; compat_uptr_t iov_base;
......
...@@ -22,14 +22,14 @@ ...@@ -22,14 +22,14 @@
#include <asm/uaccess.h> #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)) || return (verify_area(VERIFY_READ, cts, sizeof(*cts)) ||
__get_user(ts->tv_sec, &cts->tv_sec) || __get_user(ts->tv_sec, &cts->tv_sec) ||
__get_user(ts->tv_nsec, &cts->tv_nsec)) ? -EFAULT : 0; __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)) || return (verify_area(VERIFY_WRITE, cts, sizeof(*cts)) ||
__put_user(ts->tv_sec, &cts->tv_sec) || __put_user(ts->tv_sec, &cts->tv_sec) ||
......
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