]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
LINUX: fix array indexing issue in memory statistics
authorChas Williams (CONTRACTOR) <chas@cmf.nrl.navy.mil>
Thu, 17 Jan 2013 02:16:31 +0000 (21:16 -0500)
committerDerrick Brashear <shadow@your-file-system.com>
Fri, 18 Jan 2013 12:25:44 +0000 (04:25 -0800)
The comma is a sequence point and i gets incremented and then used.
This results in writing past the end of the array by one (and failing
to initialize the first element as well).

Potential fix for RT ticket 131566.

Change-Id: Iabe7e78961d1f5348bca75ca5b9e6e29d8554957
Reviewed-on: http://gerrit.openafs.org/8914
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
src/afs/LINUX/osi_alloc.c
src/afs/LINUX24/osi_alloc.c

index 7b9c929847c31b91b40ed01aea1e496734420439..6fbaf0074677ba91c33758254b22675c04336c67 100644 (file)
@@ -262,7 +262,8 @@ get_hash_stats(void)
     afs_lhash_stat(lh_mem_htab, &afs_linux_lsb);
 
     /* clear out the bucket stat vector */
-    for (i = 0; i < MAX_BUCKET_LEN; i++, afs_linux_hash_bucket_dist[i] = 0);
+    for (i = 0; i < MAX_BUCKET_LEN; i++)
+       afs_linux_hash_bucket_dist[i] = 0;
     cur_bucket = cur_bucket_len = 00;
 
     /* populate the bucket stat vector */
index d4f91cba3e7d63b8ff70ef1f21ed7a7b54ae5724..62981cfe31bf2e4cb179d392745aa2a885779b0e 100644 (file)
@@ -275,7 +275,8 @@ get_hash_stats(void)
     afs_lhash_stat(lh_mem_htab, &afs_linux_lsb);
 
     /* clear out the bucket stat vector */
-    for (i = 0; i < MAX_BUCKET_LEN; i++, afs_linux_hash_bucket_dist[i] = 0);
+    for (i = 0; i < MAX_BUCKET_LEN; i++)
+       afs_linux_hash_bucket_dist[i] = 0;
     cur_bucket = cur_bucket_len = 00;
 
     /* populate the bucket stat vector */