drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.c: adjust array index
authorJulia Lawall <julia@diku.dk>
Thu, 28 Jul 2011 12:46:04 +0000 (14:46 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 2 Aug 2011 23:10:18 +0000 (16:10 -0700)
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.c

index c01c0cb..b99a11a 100644 (file)
@@ -812,7 +812,7 @@ int AthCreateCommandList(struct ps_cmd_packet **HciPacketList, u32 *numPackets)
     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++) {