netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [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

* Re: [PATCH 1/6] net: adjust array index
  2011-07-28 12:46 ` [PATCH 1/6] net: adjust array index Julia Lawall
@ 2011-08-01  9:27   ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2011-08-01  9:27 UTC (permalink / raw)
  To: julia
  Cc: kernel-janitors, kuznet, pekkas, jmorris, yoshfuji, kaber, netdev,
	linux-kernel

From: Julia Lawall <julia@diku.dk>
Date: Thu, 28 Jul 2011 14:46:01 +0200

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

Applied.

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

* Re: [PATCH 3/6] drivers/net/niu.c: adjust array index
       [not found]   ` <1311857165-14780-4-git-send-email-julia-dAYI7NvHqcQ@public.gmane.org>
@ 2011-08-01  9:27     ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2011-08-01  9:27 UTC (permalink / raw)
  To: julia-dAYI7NvHqcQ
  Cc: eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w,
	netdev-u79uwXL29TY76Z2rM5mHXA,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	mirq-linux-CoA6ZxLDdyEEUmgCuDUIdw,
	bhutchings-s/n/eUQHGBpZroRs9YW3xA,
	shemminger-ZtmgI6mnKB3QT0dZR+AlfA

From: Julia Lawall <julia-dAYI7NvHqcQ@public.gmane.org>
Date: Thu, 28 Jul 2011 14:46:03 +0200

> From: Julia Lawall <julia-dAYI7NvHqcQ@public.gmane.org>
> 
> 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-dAYI7NvHqcQ@public.gmane.org>

Applied.

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

end of thread, other threads:[~2011-08-01  9:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [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-08-01  9:27   ` David Miller
2011-07-28 12:46 ` [PATCH 3/6] drivers/net/niu.c: " Julia Lawall
     [not found]   ` <1311857165-14780-4-git-send-email-julia-dAYI7NvHqcQ@public.gmane.org>
2011-08-01  9:27     ` 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).