diff options
author | Neil Horman <nhorman@tuxdriver.com> | 2013-02-13 11:32:42 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-02-13 11:56:46 -0500 |
commit | 959d5fdee7aa32fa04bc2c37e3d3871ad266fe97 (patch) | |
tree | 85aed09aeaf78fd08d7254d3241ed35df032721d /net | |
parent | 99d5851eefe589346c976a4b539ee498267bc5fd (diff) |
netpoll: fix smatch warnings in netpoll core code
Dan Carpenter contacted me with some notes regarding some smatch warnings in the
netpoll code, some of which I introduced with my recent netpoll locking fixes,
some which were there prior. Specifically they were:
net-next/net/core/netpoll.c:243 netpoll_poll_dev() warn: inconsistent
returns mutex:&ni->dev_lock: locked (213,217) unlocked (210,243)
net-next/net/core/netpoll.c:706 netpoll_neigh_reply() warn: potential
pointer math issue ('skb_transport_header(send_skb)' is a 128 bit pointer)
This patch corrects the locking imbalance (the first error), and adds some
parenthesis to correct the second error. Tested by myself. Applies to net-next
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
CC: Dan Carpenter <dan.carpenter@oracle.com>
CC: "David S. Miller" <davem@davemloft.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/netpoll.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/net/core/netpoll.c b/net/core/netpoll.c index bcfd4f4599a5..fa32899006a2 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c | |||
@@ -209,12 +209,16 @@ static void netpoll_poll_dev(struct net_device *dev) | |||
209 | if (!mutex_trylock(&ni->dev_lock)) | 209 | if (!mutex_trylock(&ni->dev_lock)) |
210 | return; | 210 | return; |
211 | 211 | ||
212 | if (!dev || !netif_running(dev)) | 212 | if (!netif_running(dev)) { |
213 | mutex_unlock(&ni->dev_lock); | ||
213 | return; | 214 | return; |
215 | } | ||
214 | 216 | ||
215 | ops = dev->netdev_ops; | 217 | ops = dev->netdev_ops; |
216 | if (!ops->ndo_poll_controller) | 218 | if (!ops->ndo_poll_controller) { |
219 | mutex_unlock(&ni->dev_lock); | ||
217 | return; | 220 | return; |
221 | } | ||
218 | 222 | ||
219 | /* Process pending work on NIC */ | 223 | /* Process pending work on NIC */ |
220 | ops->ndo_poll_controller(dev); | 224 | ops->ndo_poll_controller(dev); |
@@ -703,7 +707,7 @@ static void netpoll_neigh_reply(struct sk_buff *skb, struct netpoll_info *npinfo | |||
703 | icmp6h->icmp6_type = NDISC_NEIGHBOUR_ADVERTISEMENT; | 707 | icmp6h->icmp6_type = NDISC_NEIGHBOUR_ADVERTISEMENT; |
704 | icmp6h->icmp6_router = 0; | 708 | icmp6h->icmp6_router = 0; |
705 | icmp6h->icmp6_solicited = 1; | 709 | icmp6h->icmp6_solicited = 1; |
706 | target = (struct in6_addr *)skb_transport_header(send_skb) + sizeof(struct icmp6hdr); | 710 | target = (struct in6_addr *)(skb_transport_header(send_skb) + sizeof(struct icmp6hdr)); |
707 | *target = msg->target; | 711 | *target = msg->target; |
708 | icmp6h->icmp6_cksum = csum_ipv6_magic(saddr, daddr, size, | 712 | icmp6h->icmp6_cksum = csum_ipv6_magic(saddr, daddr, size, |
709 | IPPROTO_ICMPV6, | 713 | IPPROTO_ICMPV6, |