Netdev Archive on lore.kernel.org
 help / color / 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	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: Pass NULL to skb_network_protocol() when we don't care about vlan depth
  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
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2020-07-31 23:42 UTC (permalink / raw)
  To: linmiaohe
  Cc: kuba, jiri, edumazet, ap420073, xiyou.wangcong, lukas, maximmi,
	netdev, linux-kernel

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.

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

* Re: [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, 0 replies; 4+ messages in thread
From: David Miller @ 2020-08-03 22:39 UTC (permalink / raw)
  To: linmiaohe
  Cc: kuba, pshelar, martin.varghese, fw, pabeni, edumazet, dcaratti,
	steffen.klassert, shmulik, kyk.segfault, netdev, linux-kernel

From: linmiaohe <linmiaohe@huawei.com>
Date: Sat, 1 Aug 2020 17:36:05 +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.

^ permalink raw reply	[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	[flat|nested] 4+ messages in thread

end of thread, back to index

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

Netdev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/netdev/0 netdev/git/0.git
	git clone --mirror https://lore.kernel.org/netdev/1 netdev/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 netdev netdev/ https://lore.kernel.org/netdev \
		netdev@vger.kernel.org
	public-inbox-index netdev

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.netdev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git