summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--net/socket.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/net/socket.c b/net/socket.c
index a838a67dd77d..806b36512205 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -1903,15 +1903,12 @@ SYSCALL_DEFINE3(sendmsg, int, fd, struct msghdr __user *, msg, unsigned, flags)
int fput_needed;
err = -EFAULT;
- if (MSG_CMSG_COMPAT & flags) {
- if (get_compat_msghdr(&msg_sys, msg_compat))
- return -EFAULT;
- }
- else {
+ if (MSG_CMSG_COMPAT & flags)
+ err = get_compat_msghdr(&msg_sys, msg_compat);
+ else
err = copy_msghdr_from_user(&msg_sys, msg);
- if (err)
- return err;
- }
+ if (err)
+ return err;
sock = sockfd_lookup_light(fd, &err, &fput_needed);
if (!sock)
@@ -2016,15 +2013,12 @@ SYSCALL_DEFINE3(recvmsg, int, fd, struct msghdr __user *, msg,
struct sockaddr __user *uaddr;
int __user *uaddr_len;
- if (MSG_CMSG_COMPAT & flags) {
- if (get_compat_msghdr(&msg_sys, msg_compat))
- return -EFAULT;
- }
- else {
+ if (MSG_CMSG_COMPAT & flags)
+ err = get_compat_msghdr(&msg_sys, msg_compat);
+ else
err = copy_msghdr_from_user(&msg_sys, msg);
- if (err)
- return err;
- }
+ if (err)
+ return err;
sock = sockfd_lookup_light(fd, &err, &fput_needed);
if (!sock)