diff options
| author | Jarno Rajahalme <jarno@ovn.org> | 2016-11-18 18:40:42 -0500 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2016-11-19 10:37:03 -0500 |
| commit | 5a2138812604c32b7617b3b2e53e336617121d3b (patch) | |
| tree | be6e71e9341b9f969e45539071b631238b14fd7f /net/packet | |
| parent | db60eb5f6506cbfb437cf51be050368e6577a848 (diff) | |
af_packet: Use virtio_net_hdr_from_skb() directly.
Remove static function __packet_rcv_vnet(), which only called
virtio_net_hdr_from_skb() and BUG()ged out if an error code was
returned. Instead, call virtio_net_hdr_from_skb() from the former
call sites of __packet_rcv_vnet() and actually use the error handling
code that is already there.
Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/packet')
| -rw-r--r-- | net/packet/af_packet.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 1816b77e55b5..fab9bbfdead5 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
| @@ -1967,15 +1967,6 @@ static unsigned int run_filter(struct sk_buff *skb, | |||
| 1967 | return res; | 1967 | return res; |
| 1968 | } | 1968 | } |
| 1969 | 1969 | ||
| 1970 | static int __packet_rcv_vnet(const struct sk_buff *skb, | ||
| 1971 | struct virtio_net_hdr *vnet_hdr) | ||
| 1972 | { | ||
| 1973 | if (virtio_net_hdr_from_skb(skb, vnet_hdr, vio_le())) | ||
| 1974 | BUG(); | ||
| 1975 | |||
| 1976 | return 0; | ||
| 1977 | } | ||
| 1978 | |||
| 1979 | static int packet_rcv_vnet(struct msghdr *msg, const struct sk_buff *skb, | 1970 | static int packet_rcv_vnet(struct msghdr *msg, const struct sk_buff *skb, |
| 1980 | size_t *len) | 1971 | size_t *len) |
| 1981 | { | 1972 | { |
| @@ -1985,7 +1976,7 @@ static int packet_rcv_vnet(struct msghdr *msg, const struct sk_buff *skb, | |||
| 1985 | return -EINVAL; | 1976 | return -EINVAL; |
| 1986 | *len -= sizeof(vnet_hdr); | 1977 | *len -= sizeof(vnet_hdr); |
| 1987 | 1978 | ||
| 1988 | if (__packet_rcv_vnet(skb, &vnet_hdr)) | 1979 | if (virtio_net_hdr_from_skb(skb, &vnet_hdr, vio_le())) |
| 1989 | return -EINVAL; | 1980 | return -EINVAL; |
| 1990 | 1981 | ||
| 1991 | return memcpy_to_msg(msg, (void *)&vnet_hdr, sizeof(vnet_hdr)); | 1982 | return memcpy_to_msg(msg, (void *)&vnet_hdr, sizeof(vnet_hdr)); |
| @@ -2244,8 +2235,9 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, | |||
| 2244 | spin_unlock(&sk->sk_receive_queue.lock); | 2235 | spin_unlock(&sk->sk_receive_queue.lock); |
| 2245 | 2236 | ||
| 2246 | if (po->has_vnet_hdr) { | 2237 | if (po->has_vnet_hdr) { |
| 2247 | if (__packet_rcv_vnet(skb, h.raw + macoff - | 2238 | if (virtio_net_hdr_from_skb(skb, h.raw + macoff - |
| 2248 | sizeof(struct virtio_net_hdr))) { | 2239 | sizeof(struct virtio_net_hdr), |
| 2240 | vio_le())) { | ||
| 2249 | spin_lock(&sk->sk_receive_queue.lock); | 2241 | spin_lock(&sk->sk_receive_queue.lock); |
| 2250 | goto drop_n_account; | 2242 | goto drop_n_account; |
| 2251 | } | 2243 | } |
