diff mbox series

net: Pass NULL to skb_network_protocol() when we don't care about vlan depth

Message ID 1596106956-22054-1-git-send-email-linmiaohe@huawei.com
State Accepted
Delegated to: David Miller
Headers show
Series net: Pass NULL to skb_network_protocol() when we don't care about vlan depth | expand

Commit Message

Miaohe Lin July 30, 2020, 11:02 a.m. UTC
From: Miaohe Lin <linmiaohe@huawei.com>

When we don't care about vlan depth, we could pass NULL instead of the
address of a unused local variable to skb_network_protocol() as a param.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
 net/core/dev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

David Miller July 31, 2020, 11:42 p.m. UTC | #1
From: linmiaohe <linmiaohe@huawei.com>
Date: Thu, 30 Jul 2020 19:02:36 +0800

> From: Miaohe Lin <linmiaohe@huawei.com>
> 
> When we don't care about vlan depth, we could pass NULL instead of the
> address of a unused local variable to skb_network_protocol() as a param.
> 
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>

Applied to net-next, thanks.
diff mbox series

Patch

diff --git a/net/core/dev.c b/net/core/dev.c
index 7a774ebf64e2..474da11d18c9 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3448,10 +3448,9 @@  static netdev_features_t net_mpls_features(struct sk_buff *skb,
 static netdev_features_t harmonize_features(struct sk_buff *skb,
 	netdev_features_t features)
 {
-	int tmp;
 	__be16 type;
 
-	type = skb_network_protocol(skb, &tmp);
+	type = skb_network_protocol(skb, NULL);
 	features = net_mpls_features(skb, features, type);
 
 	if (skb->ip_summed != CHECKSUM_NONE &&