* [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 ` Julia Lawall [not found] ` <1311857165-14780-4-git-send-email-julia-dAYI7NvHqcQ@public.gmane.org> 0 siblings, 1 reply; 2+ 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] 2+ messages in thread
[parent not found: <1311857165-14780-4-git-send-email-julia-dAYI7NvHqcQ@public.gmane.org>]
* 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; 2+ 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] 2+ messages in thread
end of thread, other threads:[~2011-08-01 9:27 UTC | newest]
Thread overview: 2+ 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 3/6] drivers/net/niu.c: adjust array index 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).