diff options
Diffstat (limited to 'net/ipv4/raw.c')
-rw-r--r-- | net/ipv4/raw.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index 5b1ec586bae6..d1835b1bc8c4 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c | |||
@@ -259,7 +259,7 @@ int raw_rcv(struct sock *sk, struct sk_buff *skb) | |||
259 | return 0; | 259 | return 0; |
260 | } | 260 | } |
261 | 261 | ||
262 | static int raw_send_hdrinc(struct sock *sk, void *from, int length, | 262 | static int raw_send_hdrinc(struct sock *sk, void *from, size_t length, |
263 | struct rtable *rt, | 263 | struct rtable *rt, |
264 | unsigned int flags) | 264 | unsigned int flags) |
265 | { | 265 | { |
@@ -298,7 +298,7 @@ static int raw_send_hdrinc(struct sock *sk, void *from, int length, | |||
298 | goto error_fault; | 298 | goto error_fault; |
299 | 299 | ||
300 | /* We don't modify invalid header */ | 300 | /* We don't modify invalid header */ |
301 | if (length >= sizeof(*iph) && iph->ihl * 4 <= length) { | 301 | if (length >= sizeof(*iph) && iph->ihl * 4U <= length) { |
302 | if (!iph->saddr) | 302 | if (!iph->saddr) |
303 | iph->saddr = rt->rt_src; | 303 | iph->saddr = rt->rt_src; |
304 | iph->check = 0; | 304 | iph->check = 0; |
@@ -332,7 +332,7 @@ static void raw_probe_proto_opt(struct flowi *fl, struct msghdr *msg) | |||
332 | u8 __user *type = NULL; | 332 | u8 __user *type = NULL; |
333 | u8 __user *code = NULL; | 333 | u8 __user *code = NULL; |
334 | int probed = 0; | 334 | int probed = 0; |
335 | int i; | 335 | unsigned int i; |
336 | 336 | ||
337 | if (!msg->msg_iov) | 337 | if (!msg->msg_iov) |
338 | return; | 338 | return; |
@@ -384,7 +384,7 @@ static int raw_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
384 | int err; | 384 | int err; |
385 | 385 | ||
386 | err = -EMSGSIZE; | 386 | err = -EMSGSIZE; |
387 | if (len < 0 || len > 0xFFFF) | 387 | if (len > 0xFFFF) |
388 | goto out; | 388 | goto out; |
389 | 389 | ||
390 | /* | 390 | /* |
@@ -514,7 +514,10 @@ done: | |||
514 | kfree(ipc.opt); | 514 | kfree(ipc.opt); |
515 | ip_rt_put(rt); | 515 | ip_rt_put(rt); |
516 | 516 | ||
517 | out: return err < 0 ? err : len; | 517 | out: |
518 | if (err < 0) | ||
519 | return err; | ||
520 | return len; | ||
518 | 521 | ||
519 | do_confirm: | 522 | do_confirm: |
520 | dst_confirm(&rt->u.dst); | 523 | dst_confirm(&rt->u.dst); |
@@ -610,7 +613,10 @@ static int raw_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
610 | copied = skb->len; | 613 | copied = skb->len; |
611 | done: | 614 | done: |
612 | skb_free_datagram(sk, skb); | 615 | skb_free_datagram(sk, skb); |
613 | out: return err ? err : copied; | 616 | out: |
617 | if (err) | ||
618 | return err; | ||
619 | return copied; | ||
614 | } | 620 | } |
615 | 621 | ||
616 | static int raw_init(struct sock *sk) | 622 | static int raw_init(struct sock *sk) |
@@ -691,11 +697,11 @@ static int raw_ioctl(struct sock *sk, int cmd, unsigned long arg) | |||
691 | struct sk_buff *skb; | 697 | struct sk_buff *skb; |
692 | int amount = 0; | 698 | int amount = 0; |
693 | 699 | ||
694 | spin_lock_irq(&sk->sk_receive_queue.lock); | 700 | spin_lock_bh(&sk->sk_receive_queue.lock); |
695 | skb = skb_peek(&sk->sk_receive_queue); | 701 | skb = skb_peek(&sk->sk_receive_queue); |
696 | if (skb != NULL) | 702 | if (skb != NULL) |
697 | amount = skb->len; | 703 | amount = skb->len; |
698 | spin_unlock_irq(&sk->sk_receive_queue.lock); | 704 | spin_unlock_bh(&sk->sk_receive_queue.lock); |
699 | return put_user(amount, (int __user *)arg); | 705 | return put_user(amount, (int __user *)arg); |
700 | } | 706 | } |
701 | 707 | ||