netpoll: fix smatch warnings in netpoll core code
Subsystems (2)
PATCH 1/1 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
--- net/core/netpoll.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
net/core/netpoll.c +7 -3
@@ -209,12 +209,16 @@ static void netpoll_poll_dev(struct net_device *dev)if (!mutex_trylock (&ni->dev_lock))return ; -if (!dev || !netif_running (dev)) +if (!netif_running (dev)) { +mutex_unlock (&ni->dev_lock);return ; + } ops = dev->netdev_ops; -if (!ops->ndo_poll_controller) +if (!ops->ndo_poll_controller) { +mutex_unlock (&ni->dev_lock);return ; + }/* Process pending work on NIC */ ops->ndo_poll_controller (dev);
@@ -703,7 +707,7 @@ static void netpoll_neigh_reply(struct sk_buff *skb, struct netpoll_info *npinfo icmp6h->icmp6_type =NDISC_NEIGHBOUR_ADVERTISEMENT ; icmp6h->icmp6_router =0 ; icmp6h->icmp6_solicited =1 ; - target = (struct in6_addr *)skb_transport_header (send_skb) +sizeof (struct icmp6hdr ); + target = (struct in6_addr *)(skb_transport_header (send_skb) +sizeof (struct icmp6hdr )); *target = msg->target; icmp6h->icmp6_cksum = csum_ipv6_magic(saddr, daddr, size, IPPROTO_ICMPV6,
Signature · 1 line
1.7.11.7
From: Neil Horman <[email protected]>
Date: Wed, 13 Feb 2013 11:32:42 -0500
Quoted 9 lines
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:243netpoll_poll_dev()warn: inconsistent
returns mutex:&ni->dev_lock: locked (213,217) unlocked (210,243)net-next/net/core/netpoll.c:706netpoll_neigh_reply()warn: potential
pointer math issue ('skb_transport_header(send_skb)' is a 128 bit pointer)
Quoted 4 lines
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 <[email protected]>
Applied, thanks Neil.
Again, please specify in the Subject line the destination tree.
Quoted 12 lines · David Miller
From: Neil Horman <[email protected]>
Date: Wed, 13 Feb 2013 11:32:42 -0500Quoted 9 lines
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:243netpoll_poll_dev()warn: inconsistent
returns mutex:&ni->dev_lock: locked (213,217) unlocked (210,243)net-next/net/core/netpoll.c:706netpoll_neigh_reply()warn: potential
pointer math issue ('skb_transport_header(send_skb)' is a 128 bit pointer)
Quoted 8 lines
Quoted 4 lines
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 <[email protected]>Applied, thanks Neil.
Again, please specify in the Subject line the destination tree.
Sorry dave, I specified net-next in the changelog, didn't realize you preferred it in the subject.
Neil
Quoted 5 lines
--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html