All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] adjust array index
@ 2011-07-28 12:46 ` Julia Lawall
  0 siblings, 0 replies; 23+ messages in thread
From: Julia Lawall @ 2011-07-28 12:46 UTC (permalink / raw)
  To: linux-kernel; +Cc: kernel-janitors

These patches fix cases where the upper bound of a loop is used as an array
indes, while it appears that the loop index should be used as the array
index.  I have only guessed that the code is incorrect, not actually tested
any of it.


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

* [PATCH 0/6] adjust array index
@ 2011-07-28 12:46 ` Julia Lawall
  0 siblings, 0 replies; 23+ messages in thread
From: Julia Lawall @ 2011-07-28 12:46 UTC (permalink / raw)
  To: linux-kernel; +Cc: kernel-janitors

These patches fix cases where the upper bound of a loop is used as an array
indes, while it appears that the loop index should be used as the array
index.  I have only guessed that the code is incorrect, not actually tested
any of it.


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

* [PATCH 1/6] net: adjust array index
  2011-07-28 12:46 ` Julia Lawall
@ 2011-07-28 12:46   ` Julia Lawall
  -1 siblings, 0 replies; 23+ 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] 23+ messages in thread

* [PATCH 1/6] net: adjust array index
@ 2011-07-28 12:46   ` Julia Lawall
  0 siblings, 0 replies; 23+ 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] 23+ messages in thread

* [PATCH 2/6] drivers/media/dvb/dvb-usb/usb-urb.c: adjust array index
  2011-07-28 12:46 ` Julia Lawall
@ 2011-07-28 12:46   ` Julia Lawall
  -1 siblings, 0 replies; 23+ messages in thread
From: Julia Lawall @ 2011-07-28 12:46 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: kernel-janitors, linux-media, 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.

 drivers/media/dvb/dvb-usb/usb-urb.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff -u -p a/drivers/media/dvb/dvb-usb/usb-urb.c b/drivers/media/dvb/dvb-usb/usb-urb.c
--- a/drivers/media/dvb/dvb-usb/usb-urb.c
+++ b/drivers/media/dvb/dvb-usb/usb-urb.c
@@ -148,7 +148,7 @@ static int usb_bulk_urb_init(struct usb_
 		if (!stream->urb_list[i]) {
 			deb_mem("not enough memory for urb_alloc_urb!.\n");
 			for (j = 0; j < i; j++)
-				usb_free_urb(stream->urb_list[i]);
+				usb_free_urb(stream->urb_list[j]);
 			return -ENOMEM;
 		}
 		usb_fill_bulk_urb( stream->urb_list[i], stream->udev,
@@ -181,7 +181,7 @@ static int usb_isoc_urb_init(struct usb_
 		if (!stream->urb_list[i]) {
 			deb_mem("not enough memory for urb_alloc_urb!\n");
 			for (j = 0; j < i; j++)
-				usb_free_urb(stream->urb_list[i]);
+				usb_free_urb(stream->urb_list[j]);
 			return -ENOMEM;
 		}
 


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

* [PATCH 2/6] drivers/media/dvb/dvb-usb/usb-urb.c: adjust array index
@ 2011-07-28 12:46   ` Julia Lawall
  0 siblings, 0 replies; 23+ messages in thread
From: Julia Lawall @ 2011-07-28 12:46 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: kernel-janitors, linux-media, 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.

 drivers/media/dvb/dvb-usb/usb-urb.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff -u -p a/drivers/media/dvb/dvb-usb/usb-urb.c b/drivers/media/dvb/dvb-usb/usb-urb.c
--- a/drivers/media/dvb/dvb-usb/usb-urb.c
+++ b/drivers/media/dvb/dvb-usb/usb-urb.c
@@ -148,7 +148,7 @@ static int usb_bulk_urb_init(struct usb_
 		if (!stream->urb_list[i]) {
 			deb_mem("not enough memory for urb_alloc_urb!.\n");
 			for (j = 0; j < i; j++)
-				usb_free_urb(stream->urb_list[i]);
+				usb_free_urb(stream->urb_list[j]);
 			return -ENOMEM;
 		}
 		usb_fill_bulk_urb( stream->urb_list[i], stream->udev,
@@ -181,7 +181,7 @@ static int usb_isoc_urb_init(struct usb_
 		if (!stream->urb_list[i]) {
 			deb_mem("not enough memory for urb_alloc_urb!\n");
 			for (j = 0; j < i; j++)
-				usb_free_urb(stream->urb_list[i]);
+				usb_free_urb(stream->urb_list[j]);
 			return -ENOMEM;
 		}
 


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

* [PATCH 3/6] drivers/net/niu.c: adjust array index
  2011-07-28 12:46 ` Julia Lawall
@ 2011-07-28 12:46   ` Julia Lawall
  -1 siblings, 0 replies; 23+ 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] 23+ messages in thread

* [PATCH 3/6] drivers/net/niu.c: adjust array index
@ 2011-07-28 12:46   ` Julia Lawall
  0 siblings, 0 replies; 23+ 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] 23+ messages in thread

* [PATCH 4/6] drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.c: adjust array index
  2011-07-28 12:46 ` Julia Lawall
@ 2011-07-28 12:46   ` Julia Lawall
  -1 siblings, 0 replies; 23+ messages in thread
From: Julia Lawall @ 2011-07-28 12:46 UTC (permalink / raw)
  To: Luis R. Rodriguez
  Cc: kernel-janitors, Naveen Singh, Greg Kroah-Hartman, Joe Perches,
	Vipin Mehta, Andy Shevchenko, devel, 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.

 drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -u -p a/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.c b/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.c
--- a/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.c
+++ b/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.c
@@ -812,7 +812,7 @@ int AthCreateCommandList(struct ps_cmd_p
     for(count = 0; count < Patch_Count; count++) {
 
         AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Freeing Patch Buffer %d \r\n",count));
-        kfree(RamPatch[Patch_Count].Data);
+	kfree(RamPatch[count].Data);
     }
 
     for(count = 0; count < Tag_Count; count++) {


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

* [PATCH 4/6] drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.c: adjust array index
@ 2011-07-28 12:46   ` Julia Lawall
  0 siblings, 0 replies; 23+ messages in thread
From: Julia Lawall @ 2011-07-28 12:46 UTC (permalink / raw)
  To: Luis R. Rodriguez
  Cc: kernel-janitors, Naveen Singh, Greg Kroah-Hartman, Joe Perches,
	Vipin Mehta, Andy Shevchenko, devel, 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.

 drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -u -p a/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.c b/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.c
--- a/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.c
+++ b/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.c
@@ -812,7 +812,7 @@ int AthCreateCommandList(struct ps_cmd_p
     for(count = 0; count < Patch_Count; count++) {
 
         AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Freeing Patch Buffer %d \r\n",count));
-        kfree(RamPatch[Patch_Count].Data);
+	kfree(RamPatch[count].Data);
     }
 
     for(count = 0; count < Tag_Count; count++) {


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

* [PATCH 5/6] sound/core/pcm_compat.c: adjust array index
  2011-07-28 12:46 ` Julia Lawall
  (?)
@ 2011-07-28 12:46   ` Julia Lawall
  -1 siblings, 0 replies; 23+ messages in thread
From: Julia Lawall @ 2011-07-28 12:46 UTC (permalink / raw)
  To: Jaroslav Kysela; +Cc: kernel-janitors, Takashi Iwai, alsa-devel, 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.

 sound/core/pcm_compat.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -u -p a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c
--- a/sound/core/pcm_compat.c
+++ b/sound/core/pcm_compat.c
@@ -342,7 +342,7 @@ static int snd_pcm_ioctl_xfern_compat(st
 			kfree(bufs);
 			return -EFAULT;
 		}
-		bufs[ch] = compat_ptr(ptr);
+		bufs[i] = compat_ptr(ptr);
 		bufptr++;
 	}
 	if (dir == SNDRV_PCM_STREAM_PLAYBACK)


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

* [PATCH 5/6] sound/core/pcm_compat.c: adjust array index
@ 2011-07-28 12:46   ` Julia Lawall
  0 siblings, 0 replies; 23+ messages in thread
From: Julia Lawall @ 2011-07-28 12:46 UTC (permalink / raw)
  To: Jaroslav Kysela; +Cc: Takashi Iwai, alsa-devel, kernel-janitors, 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.

 sound/core/pcm_compat.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -u -p a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c
--- a/sound/core/pcm_compat.c
+++ b/sound/core/pcm_compat.c
@@ -342,7 +342,7 @@ static int snd_pcm_ioctl_xfern_compat(st
 			kfree(bufs);
 			return -EFAULT;
 		}
-		bufs[ch] = compat_ptr(ptr);
+		bufs[i] = compat_ptr(ptr);
 		bufptr++;
 	}
 	if (dir = SNDRV_PCM_STREAM_PLAYBACK)


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

* [PATCH 5/6] sound/core/pcm_compat.c: adjust array index
@ 2011-07-28 12:46   ` Julia Lawall
  0 siblings, 0 replies; 23+ messages in thread
From: Julia Lawall @ 2011-07-28 12:46 UTC (permalink / raw)
  To: Jaroslav Kysela; +Cc: Takashi Iwai, alsa-devel, kernel-janitors, 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.

 sound/core/pcm_compat.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -u -p a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c
--- a/sound/core/pcm_compat.c
+++ b/sound/core/pcm_compat.c
@@ -342,7 +342,7 @@ static int snd_pcm_ioctl_xfern_compat(st
 			kfree(bufs);
 			return -EFAULT;
 		}
-		bufs[ch] = compat_ptr(ptr);
+		bufs[i] = compat_ptr(ptr);
 		bufptr++;
 	}
 	if (dir == SNDRV_PCM_STREAM_PLAYBACK)

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

* Re: [PATCH 5/6] sound/core/pcm_compat.c: adjust array index
  2011-07-28 12:46   ` Julia Lawall
  (?)
@ 2011-07-28 13:13     ` Takashi Iwai
  -1 siblings, 0 replies; 23+ messages in thread
From: Takashi Iwai @ 2011-07-28 13:13 UTC (permalink / raw)
  To: Julia Lawall; +Cc: Jaroslav Kysela, kernel-janitors, alsa-devel, linux-kernel

At Thu, 28 Jul 2011 14:46:05 +0200,
Julia Lawall wrote:
> 
> 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>

Thanks, applied now.


Takashi

> 
> ---
> Not tested.
> 
>  sound/core/pcm_compat.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff -u -p a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c
> --- a/sound/core/pcm_compat.c
> +++ b/sound/core/pcm_compat.c
> @@ -342,7 +342,7 @@ static int snd_pcm_ioctl_xfern_compat(st
>  			kfree(bufs);
>  			return -EFAULT;
>  		}
> -		bufs[ch] = compat_ptr(ptr);
> +		bufs[i] = compat_ptr(ptr);
>  		bufptr++;
>  	}
>  	if (dir == SNDRV_PCM_STREAM_PLAYBACK)
> 

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

* Re: [PATCH 5/6] sound/core/pcm_compat.c: adjust array index
@ 2011-07-28 13:13     ` Takashi Iwai
  0 siblings, 0 replies; 23+ messages in thread
From: Takashi Iwai @ 2011-07-28 13:13 UTC (permalink / raw)
  To: Julia Lawall; +Cc: alsa-devel, kernel-janitors, linux-kernel

At Thu, 28 Jul 2011 14:46:05 +0200,
Julia Lawall wrote:
> 
> 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>

Thanks, applied now.


Takashi

> 
> ---
> Not tested.
> 
>  sound/core/pcm_compat.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff -u -p a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c
> --- a/sound/core/pcm_compat.c
> +++ b/sound/core/pcm_compat.c
> @@ -342,7 +342,7 @@ static int snd_pcm_ioctl_xfern_compat(st
>  			kfree(bufs);
>  			return -EFAULT;
>  		}
> -		bufs[ch] = compat_ptr(ptr);
> +		bufs[i] = compat_ptr(ptr);
>  		bufptr++;
>  	}
>  	if (dir = SNDRV_PCM_STREAM_PLAYBACK)
> 

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

* Re: [PATCH 5/6] sound/core/pcm_compat.c: adjust array index
@ 2011-07-28 13:13     ` Takashi Iwai
  0 siblings, 0 replies; 23+ messages in thread
From: Takashi Iwai @ 2011-07-28 13:13 UTC (permalink / raw)
  To: Julia Lawall; +Cc: alsa-devel, kernel-janitors, linux-kernel

At Thu, 28 Jul 2011 14:46:05 +0200,
Julia Lawall wrote:
> 
> 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>

Thanks, applied now.


Takashi

> 
> ---
> Not tested.
> 
>  sound/core/pcm_compat.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff -u -p a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c
> --- a/sound/core/pcm_compat.c
> +++ b/sound/core/pcm_compat.c
> @@ -342,7 +342,7 @@ static int snd_pcm_ioctl_xfern_compat(st
>  			kfree(bufs);
>  			return -EFAULT;
>  		}
> -		bufs[ch] = compat_ptr(ptr);
> +		bufs[i] = compat_ptr(ptr);
>  		bufptr++;
>  	}
>  	if (dir == SNDRV_PCM_STREAM_PLAYBACK)
> 

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

* Re: [PATCH 0/6] adjust array index
  2011-07-28 12:46 ` Julia Lawall
@ 2011-07-28 17:03   ` Joe Perches
  -1 siblings, 0 replies; 23+ messages in thread
From: Joe Perches @ 2011-07-28 17:03 UTC (permalink / raw)
  To: Julia Lawall; +Cc: linux-kernel, kernel-janitors

On Thu, 2011-07-28 at 14:46 +0200, Julia Lawall wrote:
> These patches fix cases where the upper bound of a loop is used as an array
> index, while it appears that the loop index should be used as the array
> index.

Good one.


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

* Re: [PATCH 0/6] adjust array index
@ 2011-07-28 17:03   ` Joe Perches
  0 siblings, 0 replies; 23+ messages in thread
From: Joe Perches @ 2011-07-28 17:03 UTC (permalink / raw)
  To: Julia Lawall; +Cc: linux-kernel, kernel-janitors

On Thu, 2011-07-28 at 14:46 +0200, Julia Lawall wrote:
> These patches fix cases where the upper bound of a loop is used as an array
> index, while it appears that the loop index should be used as the array
> index.

Good one.


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

* Re: [PATCH 1/6] net: adjust array index
  2011-07-28 12:46   ` Julia Lawall
@ 2011-08-01  9:27     ` David Miller
  -1 siblings, 0 replies; 23+ 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] 23+ messages in thread

* Re: [PATCH 1/6] net: adjust array index
@ 2011-08-01  9:27     ` David Miller
  0 siblings, 0 replies; 23+ 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] 23+ messages in thread

* Re: [PATCH 3/6] drivers/net/niu.c: adjust array index
@ 2011-08-01  9:27     ` David Miller
  0 siblings, 0 replies; 23+ messages in thread
From: David Miller @ 2011-08-01  9:27 UTC (permalink / raw)
  To: julia
  Cc: grant.likely, kernel-janitors, bhutchings, shemminger,
	eric.dumazet, mirq-linux, netdev, linux-kernel,
	devicetree-discuss

From: Julia Lawall <julia@diku.dk>
Date: Thu, 28 Jul 2011 14:46:03 +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] 23+ messages in thread

* Re: [PATCH 3/6] drivers/net/niu.c: adjust array index
@ 2011-08-01  9:27     ` David Miller
  0 siblings, 0 replies; 23+ 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] 23+ messages in thread

* Re: [PATCH 3/6] drivers/net/niu.c: adjust array index
@ 2011-08-01  9:27     ` David Miller
  0 siblings, 0 replies; 23+ 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@diku.dk>
Date: Thu, 28 Jul 2011 14:46:03 +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] 23+ messages in thread

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

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-28 12:46 [PATCH 0/6] adjust array index Julia Lawall
2011-07-28 12:46 ` Julia Lawall
2011-07-28 12:46 ` [PATCH 1/6] net: " Julia Lawall
2011-07-28 12:46   ` Julia Lawall
2011-08-01  9:27   ` David Miller
2011-08-01  9:27     ` David Miller
2011-07-28 12:46 ` [PATCH 2/6] drivers/media/dvb/dvb-usb/usb-urb.c: " Julia Lawall
2011-07-28 12:46   ` Julia Lawall
2011-07-28 12:46 ` [PATCH 3/6] drivers/net/niu.c: " Julia Lawall
2011-07-28 12:46   ` Julia Lawall
2011-08-01  9:27   ` David Miller
2011-08-01  9:27     ` David Miller
2011-08-01  9:27     ` David Miller
2011-07-28 12:46 ` [PATCH 4/6] drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.c: " Julia Lawall
2011-07-28 12:46   ` Julia Lawall
2011-07-28 12:46 ` [PATCH 5/6] sound/core/pcm_compat.c: " Julia Lawall
2011-07-28 12:46   ` Julia Lawall
2011-07-28 12:46   ` Julia Lawall
2011-07-28 13:13   ` Takashi Iwai
2011-07-28 13:13     ` Takashi Iwai
2011-07-28 13:13     ` Takashi Iwai
2011-07-28 17:03 ` [PATCH 0/6] " Joe Perches
2011-07-28 17:03   ` Joe Perches

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.