ipv6: fix array index in ip6_mc_add_src()
Subsystems (3)
PATCH 1/1 ipv6: fix array index in ip6_mc_add_src()
From: RongQing.Li <[email protected]>
Convert array index from the loop bound to the loop index.
--- net/ipv6/mcast.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
net/ipv6/mcast.c +1 -1
@@ -2044,7 +2044,7 @@ static int ip6_mc_add_src(struct inet6_dev *idev, const struct in6_addr *pmca,if (!delta) pmc->mca_sfcount[sfmode]--;for (j=0 ; j<i; j++) - (void )ip6_mc_del1_src (pmc, sfmode, &psfsrc[i]); +ip6_mc_del1_src (pmc, sfmode, &psfsrc[j]); }else if (isexclude != (pmc->mca_sfcount[MCAST_EXCLUDE ] !=0 )) {struct ip6_sf_list *psf;
Signature · 1 line
1.7.1
David Miller
maintainerFrom: [email protected]
Date: Sun, 1 Apr 2012 16:45:26 +0800
Quoted 5 lines
From: RongQing.Li <[email protected]>
Convert array index from the loop bound to the loop index.
Signed-off-by RongQing.Li <[email protected]>
That's not all you are doing:
net/ipv6/mcast.c static int ip6_mc_add_src(struct inet6_dev *idev, const struct in6_addr *pmca, · line 2047
Quoted 2 lines
net/ipv6/mcast.c +1
-1- (void )ip6_mc_del1_src (pmc, sfmode, &psfsrc[i]); +ip6_mc_del1_src (pmc, sfmode, &psfsrc[j]);
You absolutely MUST mention and explain this (void) removal. It's probably there to elide an unchecked return value warning from the compiler.
2012/4/2 David Miller <[email protected]>:
Quoted 9 lines
From: [email protected]
Date: Sun, 1 Apr 2012 16:45:26 +0800Quoted 5 lines
From: RongQing.Li <[email protected]>
Convert array index from the loop bound to the loop index.
Signed-off-by RongQing.Li <[email protected]>
Quoted 8 lines
That's not all you are doing:
Quoted 2 lines
- (void)
ip6_mc_del1_src(pmc, sfmode, &psfsrc[i]);
+ip6_mc_del1_src(pmc, sfmode, &psfsrc[j]);You absolutely MUST mention and explain this (void) removal. It's probably there to elide an unchecked return value warning from the compiler.
since ip6_mc_del1_src() does not use __must_check likely attribute. I try to compile with several gcc warning options, but do not find which options can report the unchecked return value.
Maybe other tools will complain the unchecked return value.
So I will keep the void.
-R
David Miller
maintainerFrom: RongQing Li <[email protected]>
Date: Mon, 2 Apr 2012 18:16:14 +0800
Quoted 15 lines
2012/4/2 David Miller <[email protected]>:
Quoted 14 lines
From: [email protected]
Date: Sun, 1 Apr 2012 16:45:26 +0800Quoted 5 lines
From: RongQing.Li <[email protected]>
Convert array index from the loop bound to the loop index.
Signed-off-by RongQing.Li <[email protected]>That's not all you are doing:
Quoted 2 lines
- (void)
ip6_mc_del1_src(pmc, sfmode, &psfsrc[i]);
+ip6_mc_del1_src(pmc, sfmode, &psfsrc[j]);
Quoted 7 lines
Quoted 3 lines
You absolutely MUST mention and explain this (void) removal. It's probably there to elide an unchecked return value warning from the compiler.
since
ip6_mc_del1_src()does not use__must_checklikely attribute. I try to compile with several gcc warning options, but do not find which options can report the unchecked return value.
I said "probably", I didn't check myself.
The issue I had was that you didn't mention the void removal in the commit message.
OK, I see, thanks
BR
-Roy
2012/4/3, David Miller <[email protected]>:
Quoted 31 lines
From: RongQing Li <[email protected]>
Date: Mon, 2 Apr 2012 18:16:14 +0800Quoted 15 lines
2012/4/2 David Miller <[email protected]>:
Quoted 14 lines
From: [email protected]
Date: Sun, 1 Apr 2012 16:45:26 +0800Quoted 5 lines
From: RongQing.Li <[email protected]>
Convert array index from the loop bound to the loop index.
Signed-off-by RongQing.Li <[email protected]>That's not all you are doing:
Quoted 2 lines
net/ipv6/mcast.c +1
-1- (void )ip6_mc_del1_src (pmc, sfmode, &psfsrc[i]); +ip6_mc_del1_src (pmc, sfmode, &psfsrc[j]);Quoted 7 lines
Quoted 3 lines
You absolutely MUST mention and explain this (void) removal. It's probably there to elide an unchecked return value warning from the compiler.
since
ip6_mc_del1_src()does not use__must_checklikely attribute. I try to compile with several gcc warning options, but do not find which options can report the unchecked return value.I said "probably", I didn't check myself.
The issue I had was that you didn't mention the void removal in the commit message.