summaryrefslogtreecommitdiffstats
path: root/ipc
diff options
context:
space:
mode:
authorDeepa Dinamani <deepa.kernel@gmail.com>2017-08-02 19:51:11 -0700
committerAl Viro <viro@zeniv.linux.org.uk>2017-09-03 20:21:24 -0400
commitb9047726386bb538cf5e4f52a9f04eb556eebc67 (patch)
tree3cb2982a68670faacb4e6032c5a9c377f33db8d8 /ipc
parent3ef56dc2678258b7211b1870d034c1666becb2bd (diff)
downloadlinux-b9047726386bb538cf5e4f52a9f04eb556eebc67.tar.gz
linux-b9047726386bb538cf5e4f52a9f04eb556eebc67.tar.bz2
linux-b9047726386bb538cf5e4f52a9f04eb556eebc67.zip
ipc: mqueue: Replace timespec with timespec64
struct timespec is not y2038 safe. Replace all uses of timespec by y2038 safe struct timespec64. Even though timespec is used here to represent timeouts, replace these with timespec64 so that it facilitates in verification by creating a y2038 safe kernel image that is free of timespec. The syscall interfaces themselves are not changed as part of the patch. They will be part of a different series. Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com> Cc: Paul Moore <paul@paul-moore.com> Cc: Richard Guy Briggs <rgb@redhat.com> Reviewed-by: Richard Guy Briggs <rgb@redhat.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Paul Moore <paul@paul-moore.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'ipc')
-rw-r--r--ipc/mqueue.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index eb1391b52c6f..d24025626310 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -668,11 +668,11 @@ static void __do_notify(struct mqueue_inode_info *info)
}
static int prepare_timeout(const struct timespec __user *u_abs_timeout,
- struct timespec *ts)
+ struct timespec64 *ts)
{
- if (copy_from_user(ts, u_abs_timeout, sizeof(struct timespec)))
+ if (get_timespec64(ts, u_abs_timeout))
return -EFAULT;
- if (!timespec_valid(ts))
+ if (!timespec64_valid(ts))
return -EINVAL;
return 0;
}
@@ -962,7 +962,7 @@ static inline void pipelined_receive(struct wake_q_head *wake_q,
static int do_mq_timedsend(mqd_t mqdes, const char __user *u_msg_ptr,
size_t msg_len, unsigned int msg_prio,
- struct timespec *ts)
+ struct timespec64 *ts)
{
struct fd f;
struct inode *inode;
@@ -979,7 +979,7 @@ static int do_mq_timedsend(mqd_t mqdes, const char __user *u_msg_ptr,
return -EINVAL;
if (ts) {
- expires = timespec_to_ktime(*ts);
+ expires = timespec64_to_ktime(*ts);
timeout = &expires;
}
@@ -1080,7 +1080,7 @@ out:
static int do_mq_timedreceive(mqd_t mqdes, char __user *u_msg_ptr,
size_t msg_len, unsigned int __user *u_msg_prio,
- struct timespec *ts)
+ struct timespec64 *ts)
{
ssize_t ret;
struct msg_msg *msg_ptr;
@@ -1092,7 +1092,7 @@ static int do_mq_timedreceive(mqd_t mqdes, char __user *u_msg_ptr,
struct posix_msg_tree_node *new_leaf = NULL;
if (ts) {
- expires = timespec_to_ktime(*ts);
+ expires = timespec64_to_ktime(*ts);
timeout = &expires;
}
@@ -1184,7 +1184,7 @@ SYSCALL_DEFINE5(mq_timedsend, mqd_t, mqdes, const char __user *, u_msg_ptr,
size_t, msg_len, unsigned int, msg_prio,
const struct timespec __user *, u_abs_timeout)
{
- struct timespec ts, *p = NULL;
+ struct timespec64 ts, *p = NULL;
if (u_abs_timeout) {
int res = prepare_timeout(u_abs_timeout, &ts);
if (res)
@@ -1198,7 +1198,7 @@ SYSCALL_DEFINE5(mq_timedreceive, mqd_t, mqdes, char __user *, u_msg_ptr,
size_t, msg_len, unsigned int __user *, u_msg_prio,
const struct timespec __user *, u_abs_timeout)
{
- struct timespec ts, *p = NULL;
+ struct timespec64 ts, *p = NULL;
if (u_abs_timeout) {
int res = prepare_timeout(u_abs_timeout, &ts);
if (res)
@@ -1475,11 +1475,11 @@ COMPAT_SYSCALL_DEFINE4(mq_open, const char __user *, u_name,
}
static int compat_prepare_timeout(const struct compat_timespec __user *p,
- struct timespec *ts)
+ struct timespec64 *ts)
{
- if (compat_get_timespec(ts, p))
+ if (compat_get_timespec64(ts, p))
return -EFAULT;
- if (!timespec_valid(ts))
+ if (!timespec64_valid(ts))
return -EINVAL;
return 0;
}
@@ -1489,7 +1489,7 @@ COMPAT_SYSCALL_DEFINE5(mq_timedsend, mqd_t, mqdes,
compat_size_t, msg_len, unsigned int, msg_prio,
const struct compat_timespec __user *, u_abs_timeout)
{
- struct timespec ts, *p = NULL;
+ struct timespec64 ts, *p = NULL;
if (u_abs_timeout) {
int res = compat_prepare_timeout(u_abs_timeout, &ts);
if (res)
@@ -1504,7 +1504,7 @@ COMPAT_SYSCALL_DEFINE5(mq_timedreceive, mqd_t, mqdes,
compat_size_t, msg_len, unsigned int __user *, u_msg_prio,
const struct compat_timespec __user *, u_abs_timeout)
{
- struct timespec ts, *p = NULL;
+ struct timespec64 ts, *p = NULL;
if (u_abs_timeout) {
int res = compat_prepare_timeout(u_abs_timeout, &ts);
if (res)