* [PATCH 1/6] net: adjust array index
[not found] <1311857165-14780-1-git-send-email-julia@diku.dk>
@ 2011-07-28 12:46 ` Julia Lawall
2011-08-01 9:27 ` David Miller
2011-07-28 12:46 ` [PATCH 3/6] drivers/net/niu.c: " Julia Lawall
1 sibling, 1 reply; 4+ messages in thread
From: Julia Lawall @ 2011-07-28 12:46 UTC (permalink / raw)
To: David S. Miller
Cc: kernel-janitors, Alexey Kuznetsov, Pekka Savola (ipv6),
James Morris, Hideaki YOSHIFUJI, Patrick McHardy, netdev,
linux-kernel
From: Julia Lawall <julia@diku.dk>
Convert array index from the loop bound to the loop index.
A simplified version of the semantic patch that fixes this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
expression e1,e2,ar;
@@
for(e1 = 0; e1 < e2; e1++) { <...
ar[
- e2
+ e1
]
...> }
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
Not tested.
net/ipv4/igmp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff -u -p a/net/ipv4/igmp.c b/net/ipv4/igmp.c
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -1718,7 +1718,7 @@ static int ip_mc_add_src(struct in_devic
pmc->sfcount[sfmode]--;
for (j=0; j<i; j++)
- (void) ip_mc_del1_src(pmc, sfmode, &psfsrc[i]);
+ (void) ip_mc_del1_src(pmc, sfmode, &psfsrc[j]);
} else if (isexclude != (pmc->sfcount[MCAST_EXCLUDE] != 0)) {
#ifdef CONFIG_IP_MULTICAST
struct ip_sf_list *psf;
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 3/6] drivers/net/niu.c: adjust array index
[not found] <1311857165-14780-1-git-send-email-julia@diku.dk>
2011-07-28 12:46 ` [PATCH 1/6] net: adjust array index Julia Lawall
@ 2011-07-28 12:46 ` Julia Lawall
[not found] ` <1311857165-14780-4-git-send-email-julia-dAYI7NvHqcQ@public.gmane.org>
1 sibling, 1 reply; 4+ messages in thread
From: Julia Lawall @ 2011-07-28 12:46 UTC (permalink / raw)
To: Grant Likely
Cc: kernel-janitors, David S. Miller, Ben Hutchings,
Stephen Hemminger, Eric Dumazet, Michał Mirosław,
netdev, linux-kernel, devicetree-discuss
From: Julia Lawall <julia@diku.dk>
Convert array index from the loop bound to the loop index.
A simplified version of the semantic patch that fixes this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
expression e1,e2,ar;
@@
for(e1 = 0; e1 < e2; e1++) { <...
ar[
- e2
+ e1
]
...> }
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
Not tested.
drivers/net/niu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff -u -p a/drivers/net/niu.c b/drivers/net/niu.c
--- a/drivers/net/niu.c
+++ b/drivers/net/niu.c
@@ -9201,7 +9201,7 @@ static int __devinit niu_ldg_init(struct
first_chan = 0;
for (i = 0; i < port; i++)
- first_chan += parent->rxchan_per_port[port];
+ first_chan += parent->rxchan_per_port[i];
num_chan = parent->rxchan_per_port[port];
for (i = first_chan; i < (first_chan + num_chan); i++) {
@@ -9217,7 +9217,7 @@ static int __devinit niu_ldg_init(struct
first_chan = 0;
for (i = 0; i < port; i++)
- first_chan += parent->txchan_per_port[port];
+ first_chan += parent->txchan_per_port[i];
num_chan = parent->txchan_per_port[port];
for (i = first_chan; i < (first_chan + num_chan); i++) {
err = niu_ldg_assign_ldn(np, parent,
^ permalink raw reply [flat|nested] 4+ messages in thread