Skip to content

Commit

Permalink
net: use compat helper functions in compat_sys_recvmmsg
Browse files Browse the repository at this point in the history
Use (get|put)_compat_timespec helper functions to simplify the code.

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>
  • Loading branch information
heicarst authored and davem330 committed Dec 11, 2009
1 parent 60c2ffd commit de039f0
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions net/compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -763,15 +763,12 @@ asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg,
return __sys_recvmmsg(fd, (struct mmsghdr __user *)mmsg, vlen,
flags | MSG_CMSG_COMPAT, NULL);

if (get_user(ktspec.tv_sec, &timeout->tv_sec) ||
get_user(ktspec.tv_nsec, &timeout->tv_nsec))
if (get_compat_timespec(&ktspec, timeout))
return -EFAULT;

datagrams = __sys_recvmmsg(fd, (struct mmsghdr __user *)mmsg, vlen,
flags | MSG_CMSG_COMPAT, &ktspec);
if (datagrams > 0 &&
(put_user(ktspec.tv_sec, &timeout->tv_sec) ||
put_user(ktspec.tv_nsec, &timeout->tv_nsec)))
if (datagrams > 0 && put_compat_timespec(&ktspec, timeout))
datagrams = -EFAULT;

return datagrams;
Expand Down

0 comments on commit de039f0

Please sign in to comment.