From 04ddecc1f2827463edf22857f9b19910ccc25e98 Mon Sep 17 00:00:00 2001 From: "Chas Williams (CONTRACTOR)" Date: Wed, 16 Jan 2013 21:16:31 -0500 Subject: [PATCH] LINUX: fix array indexing issue in memory statistics 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 Reviewed-by: Simon Wilkinson Reviewed-by: Derrick Brashear --- src/afs/LINUX/osi_alloc.c | 3 ++- src/afs/LINUX24/osi_alloc.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/afs/LINUX/osi_alloc.c b/src/afs/LINUX/osi_alloc.c index 7b9c929..6fbaf00 100644 --- a/src/afs/LINUX/osi_alloc.c +++ b/src/afs/LINUX/osi_alloc.c @@ -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 */ diff --git a/src/afs/LINUX24/osi_alloc.c b/src/afs/LINUX24/osi_alloc.c index d4f91cb..62981cf 100644 --- a/src/afs/LINUX24/osi_alloc.c +++ b/src/afs/LINUX24/osi_alloc.c @@ -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 */ -- 1.9.4