netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: Pass NULL to skb_network_protocol() when we don't care about vlan depth
@ 2020-07-30 11:02 linmiaohe
  2020-07-31 23:42 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: linmiaohe @ 2020-07-30 11:02 UTC (permalink / raw)
  To: davem, kuba, jiri, edumazet, ap420073, xiyou.wangcong, lukas, maximmi
  Cc: netdev, linux-kernel, linmiaohe

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(-)

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 &&
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread
* [PATCH] net: Pass NULL to skb_network_protocol() when we don't care about vlan depth
@ 2020-08-01  9:36 linmiaohe
  2020-08-03 22:39 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: linmiaohe @ 2020-08-01  9:36 UTC (permalink / raw)
  To: davem, kuba, pshelar, martin.varghese, fw, pabeni, edumazet,
	dcaratti, steffen.klassert, shmulik, kyk.segfault
  Cc: netdev, linux-kernel, linmiaohe

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/skbuff.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 3219c26ddfae..8a0c39e4ab0a 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -3758,7 +3758,6 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb,
 	int err = -ENOMEM;
 	int i = 0;
 	int pos;
-	int dummy;
 
 	if (list_skb && !list_skb->head_frag && skb_headlen(list_skb) &&
 	    (skb_shinfo(head_skb)->gso_type & SKB_GSO_DODGY)) {
@@ -3780,7 +3779,7 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb,
 	}
 
 	__skb_push(head_skb, doffset);
-	proto = skb_network_protocol(head_skb, &dummy);
+	proto = skb_network_protocol(head_skb, NULL);
 	if (unlikely(!proto))
 		return ERR_PTR(-EINVAL);
 
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-08-03 22:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-30 11:02 [PATCH] net: Pass NULL to skb_network_protocol() when we don't care about vlan depth linmiaohe
2020-07-31 23:42 ` David Miller
2020-08-01  9:36 linmiaohe
2020-08-03 22:39 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).