]> 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)
committerStephan Wiesand <stephan.wiesand@desy.de>
Fri, 22 Mar 2013 14:44:12 +0000 (07:44 -0700)
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.

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>
(cherry picked from commit 04ddecc1f2827463edf22857f9b19910ccc25e98)

Change-Id: I09a96fcb5ffc9a58f0930f76e4ee5f65628ba5c8
Reviewed-on: http://gerrit.openafs.org/9520
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
src/afs/LINUX/osi_alloc.c
src/afs/LINUX24/osi_alloc.c

index 89a7bf861ee3bcee1bb649cd5ad019303490b9c2..fc74a2cb598420def357ad941c94a11da0734155 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 */