aboutsummaryrefslogtreecommitdiffstats
path: root/net/compat.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/compat.c')
-rw-r--r--net/compat.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/net/compat.c b/net/compat.c
index 2fc6d9bb622b..0e407563ae85 100644
--- a/net/compat.c
+++ b/net/compat.c
@@ -34,11 +34,11 @@ static inline int iov_from_user_compat_to_kern(struct iovec *kiov,
34{ 34{
35 int tot_len = 0; 35 int tot_len = 0;
36 36
37 while(niov > 0) { 37 while (niov > 0) {
38 compat_uptr_t buf; 38 compat_uptr_t buf;
39 compat_size_t len; 39 compat_size_t len;
40 40
41 if(get_user(len, &uiov32->iov_len) || 41 if (get_user(len, &uiov32->iov_len) ||
42 get_user(buf, &uiov32->iov_base)) { 42 get_user(buf, &uiov32->iov_base)) {
43 tot_len = -EFAULT; 43 tot_len = -EFAULT;
44 break; 44 break;
@@ -78,12 +78,12 @@ int verify_compat_iovec(struct msghdr *kern_msg, struct iovec *kern_iov,
78{ 78{
79 int tot_len; 79 int tot_len;
80 80
81 if(kern_msg->msg_namelen) { 81 if (kern_msg->msg_namelen) {
82 if(mode==VERIFY_READ) { 82 if (mode==VERIFY_READ) {
83 int err = move_addr_to_kernel(kern_msg->msg_name, 83 int err = move_addr_to_kernel(kern_msg->msg_name,
84 kern_msg->msg_namelen, 84 kern_msg->msg_namelen,
85 kern_address); 85 kern_address);
86 if(err < 0) 86 if (err < 0)
87 return err; 87 return err;
88 } 88 }
89 kern_msg->msg_name = kern_address; 89 kern_msg->msg_name = kern_address;
@@ -93,7 +93,7 @@ int verify_compat_iovec(struct msghdr *kern_msg, struct iovec *kern_iov,
93 tot_len = iov_from_user_compat_to_kern(kern_iov, 93 tot_len = iov_from_user_compat_to_kern(kern_iov,
94 (struct compat_iovec __user *)kern_msg->msg_iov, 94 (struct compat_iovec __user *)kern_msg->msg_iov,
95 kern_msg->msg_iovlen); 95 kern_msg->msg_iovlen);
96 if(tot_len >= 0) 96 if (tot_len >= 0)
97 kern_msg->msg_iov = kern_iov; 97 kern_msg->msg_iov = kern_iov;
98 98
99 return tot_len; 99 return tot_len;
@@ -146,8 +146,8 @@ int cmsghdr_from_user_compat_to_kern(struct msghdr *kmsg, struct sock *sk,
146 kcmlen = 0; 146 kcmlen = 0;
147 kcmsg_base = kcmsg = (struct cmsghdr *)stackbuf; 147 kcmsg_base = kcmsg = (struct cmsghdr *)stackbuf;
148 ucmsg = CMSG_COMPAT_FIRSTHDR(kmsg); 148 ucmsg = CMSG_COMPAT_FIRSTHDR(kmsg);
149 while(ucmsg != NULL) { 149 while (ucmsg != NULL) {
150 if(get_user(ucmlen, &ucmsg->cmsg_len)) 150 if (get_user(ucmlen, &ucmsg->cmsg_len))
151 return -EFAULT; 151 return -EFAULT;
152 152
153 /* Catch bogons. */ 153 /* Catch bogons. */
@@ -160,7 +160,7 @@ int cmsghdr_from_user_compat_to_kern(struct msghdr *kmsg, struct sock *sk,
160 kcmlen += tmp; 160 kcmlen += tmp;
161 ucmsg = cmsg_compat_nxthdr(kmsg, ucmsg, ucmlen); 161 ucmsg = cmsg_compat_nxthdr(kmsg, ucmsg, ucmlen);
162 } 162 }
163 if(kcmlen == 0) 163 if (kcmlen == 0)
164 return -EINVAL; 164 return -EINVAL;
165 165
166 /* The kcmlen holds the 64-bit version of the control length. 166 /* The kcmlen holds the 64-bit version of the control length.
@@ -176,7 +176,7 @@ int cmsghdr_from_user_compat_to_kern(struct msghdr *kmsg, struct sock *sk,
176 /* Now copy them over neatly. */ 176 /* Now copy them over neatly. */
177 memset(kcmsg, 0, kcmlen); 177 memset(kcmsg, 0, kcmlen);
178 ucmsg = CMSG_COMPAT_FIRSTHDR(kmsg); 178 ucmsg = CMSG_COMPAT_FIRSTHDR(kmsg);
179 while(ucmsg != NULL) { 179 while (ucmsg != NULL) {
180 if (__get_user(ucmlen, &ucmsg->cmsg_len)) 180 if (__get_user(ucmlen, &ucmsg->cmsg_len))
181 goto Efault; 181 goto Efault;
182 if (!CMSG_COMPAT_OK(ucmlen, ucmsg, kmsg)) 182 if (!CMSG_COMPAT_OK(ucmlen, ucmsg, kmsg))
@@ -219,7 +219,7 @@ int put_cmsg_compat(struct msghdr *kmsg, int level, int type, int len, void *dat
219 struct compat_cmsghdr cmhdr; 219 struct compat_cmsghdr cmhdr;
220 int cmlen; 220 int cmlen;
221 221
222 if(cm == NULL || kmsg->msg_controllen < sizeof(*cm)) { 222 if (cm == NULL || kmsg->msg_controllen < sizeof(*cm)) {
223 kmsg->msg_flags |= MSG_CTRUNC; 223 kmsg->msg_flags |= MSG_CTRUNC;
224 return 0; /* XXX: return error? check spec. */ 224 return 0; /* XXX: return error? check spec. */
225 } 225 }
@@ -233,7 +233,7 @@ int put_cmsg_compat(struct msghdr *kmsg, int level, int type, int len, void *dat
233 } 233 }
234 234
235 cmlen = CMSG_COMPAT_LEN(len); 235 cmlen = CMSG_COMPAT_LEN(len);
236 if(kmsg->msg_controllen < cmlen) { 236 if (kmsg->msg_controllen < cmlen) {
237 kmsg->msg_flags |= MSG_CTRUNC; 237 kmsg->msg_flags |= MSG_CTRUNC;
238 cmlen = kmsg->msg_controllen; 238 cmlen = kmsg->msg_controllen;
239 } 239 }
@@ -241,9 +241,9 @@ int put_cmsg_compat(struct msghdr *kmsg, int level, int type, int len, void *dat
241 cmhdr.cmsg_type = type; 241 cmhdr.cmsg_type = type;
242 cmhdr.cmsg_len = cmlen; 242 cmhdr.cmsg_len = cmlen;
243 243
244 if(copy_to_user(cm, &cmhdr, sizeof cmhdr)) 244 if (copy_to_user(cm, &cmhdr, sizeof cmhdr))
245 return -EFAULT; 245 return -EFAULT;
246 if(copy_to_user(CMSG_COMPAT_DATA(cm), data, cmlen - sizeof(struct compat_cmsghdr))) 246 if (copy_to_user(CMSG_COMPAT_DATA(cm), data, cmlen - sizeof(struct compat_cmsghdr)))
247 return -EFAULT; 247 return -EFAULT;
248 cmlen = CMSG_COMPAT_SPACE(len); 248 cmlen = CMSG_COMPAT_SPACE(len);
249 kmsg->msg_control += cmlen; 249 kmsg->msg_control += cmlen;
@@ -646,7 +646,7 @@ asmlinkage long compat_sys_socketcall(int call, u32 __user *args)
646 a0 = a[0]; 646 a0 = a[0];
647 a1 = a[1]; 647 a1 = a[1];
648 648
649 switch(call) { 649 switch (call) {
650 case SYS_SOCKET: 650 case SYS_SOCKET:
651 ret = sys_socket(a0, a1, a[2]); 651 ret = sys_socket(a0, a1, a[2]);
652 break; 652 break;