Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1718253 > unrolled thread
| Started by | Colin King <colin.king@canonical.com> |
|---|---|
| First post | 2017-08-23 13:20 +0200 |
| Last post | 2017-08-23 20:50 +0200 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH][netdev-next] gre: remove duplicated assignment of iph Colin King <colin.king@canonical.com> - 2017-08-23 13:20 +0200
Re: [PATCH][netdev-next] gre: remove duplicated assignment of iph Nikolay Aleksandrov <nikolay@cumulusnetworks.com> - 2017-08-23 14:00 +0200
Re: [PATCH][netdev-next] gre: remove duplicated assignment of iph David Miller <davem@davemloft.net> - 2017-08-23 20:50 +0200
| From | Colin King <colin.king@canonical.com> |
|---|---|
| Date | 2017-08-23 13:20 +0200 |
| Subject | [PATCH][netdev-next] gre: remove duplicated assignment of iph |
| Message-ID | <uhBRv-8eY-1@gated-at.bofh.it> |
From: Colin Ian King <colin.king@canonical.com> iph is being assigned the same value twice; remove the redundant second assignment. Fixes warning: net/ipv4/ip_gre.c:265:2: warning: Value stored to 'iph' is never read Signed-off-by: Colin Ian King <colin.king@canonical.com> --- net/ipv4/ip_gre.c | 1 - 1 file changed, 1 deletion(-) diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index 6e8a62289e03..6b3e7c99a3b6 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c @@ -268,7 +268,6 @@ static int erspan_rcv(struct sk_buff *skb, struct tnl_ptk_info *tpi, if (unlikely(!pskb_may_pull(skb, len))) return -ENOMEM; - iph = ip_hdr(skb); ershdr = (struct erspanhdr *)(skb->data + gre_hdr_len); /* The original GRE header does not have key field, -- 2.14.1
[toc] | [next] | [standalone]
| From | Nikolay Aleksandrov <nikolay@cumulusnetworks.com> |
|---|---|
| Date | 2017-08-23 14:00 +0200 |
| Message-ID | <uhCud-8wm-7@gated-at.bofh.it> |
| In reply to | #1718253 |
On 23/08/17 14:13, Colin King wrote: > From: Colin Ian King <colin.king@canonical.com> > > iph is being assigned the same value twice; remove the redundant > second assignment. > > Fixes warning: > net/ipv4/ip_gre.c:265:2: warning: Value stored to 'iph' is never read > > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > net/ipv4/ip_gre.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c > index 6e8a62289e03..6b3e7c99a3b6 100644 > --- a/net/ipv4/ip_gre.c > +++ b/net/ipv4/ip_gre.c > @@ -268,7 +268,6 @@ static int erspan_rcv(struct sk_buff *skb, struct tnl_ptk_info *tpi, > if (unlikely(!pskb_may_pull(skb, len))) > return -ENOMEM; > > - iph = ip_hdr(skb); > ershdr = (struct erspanhdr *)(skb->data + gre_hdr_len); > > /* The original GRE header does not have key field, > This one looks like a correct assignment, I'd remove the previous one because pskb_may_pull may change the header pointers and the previously assigned iph might become wrong. Also add the author of the code to the CC list.
[toc] | [prev] | [next] | [standalone]
| From | David Miller <davem@davemloft.net> |
|---|---|
| Date | 2017-08-23 20:50 +0200 |
| Message-ID | <uhISZ-486-1@gated-at.bofh.it> |
| In reply to | #1718253 |
From: Colin King <colin.king@canonical.com> Date: Wed, 23 Aug 2017 12:13:05 +0100 > From: Colin Ian King <colin.king@canonical.com> > > iph is being assigned the same value twice; remove the redundant > second assignment. > > Fixes warning: > net/ipv4/ip_gre.c:265:2: warning: Value stored to 'iph' is never read > > Signed-off-by: Colin Ian King <colin.king@canonical.com> It is always necessary to reload any SKB header pointer after calls to functions which potentially change the data buffer of the SKB. pskb_may_pull() is one such call. Therefore your patch is adding a bug. If you want to remove the dup, you must remove the first not the second one.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web