Skip to content

Commit 60c2ffd

Browse files
heicarstdavem330
authored andcommitted
net: fix compat_sys_recvmmsg parameter type
compat_sys_recvmmsg has a compat_timespec parameter and not a timespec parameter. This way we also get rid of an odd cast. Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent ccdddf5 commit 60c2ffd

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

‎include/net/compat.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ extern asmlinkage long compat_sys_sendmsg(int,struct compat_msghdr __user *,unsi
4646
extern asmlinkage long compat_sys_recvmsg(int,struct compat_msghdr __user *,unsigned);
4747
extern asmlinkage long compat_sys_recvmmsg(int, struct compat_mmsghdr __user *,
4848
unsigned, unsigned,
49-
struct timespec __user *);
49+
struct compat_timespec __user *);
5050
extern asmlinkage long compat_sys_getsockopt(int, int, int, char __user *, int __user *);
5151
extern int put_cmsg_compat(struct msghdr*, int, int, int, void *);
5252

‎net/compat.c‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -754,26 +754,24 @@ asmlinkage long compat_sys_recvfrom(int fd, void __user *buf, size_t len,
754754

755755
asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg,
756756
unsigned vlen, unsigned int flags,
757-
struct timespec __user *timeout)
757+
struct compat_timespec __user *timeout)
758758
{
759759
int datagrams;
760760
struct timespec ktspec;
761-
struct compat_timespec __user *utspec;
762761

763762
if (timeout == NULL)
764763
return __sys_recvmmsg(fd, (struct mmsghdr __user *)mmsg, vlen,
765764
flags | MSG_CMSG_COMPAT, NULL);
766765

767-
utspec = (struct compat_timespec __user *)timeout;
768-
if (get_user(ktspec.tv_sec, &utspec->tv_sec) ||
769-
get_user(ktspec.tv_nsec, &utspec->tv_nsec))
766+
if (get_user(ktspec.tv_sec, &timeout->tv_sec) ||
767+
get_user(ktspec.tv_nsec, &timeout->tv_nsec))
770768
return -EFAULT;
771769

772770
datagrams = __sys_recvmmsg(fd, (struct mmsghdr __user *)mmsg, vlen,
773771
flags | MSG_CMSG_COMPAT, &ktspec);
774772
if (datagrams > 0 &&
775-
(put_user(ktspec.tv_sec, &utspec->tv_sec) ||
776-
put_user(ktspec.tv_nsec, &utspec->tv_nsec)))
773+
(put_user(ktspec.tv_sec, &timeout->tv_sec) ||
774+
put_user(ktspec.tv_nsec, &timeout->tv_nsec)))
777775
datagrams = -EFAULT;
778776

779777
return datagrams;

0 commit comments

Comments
 (0)