Make sure we are passed valid statistic index numbers, so passing in a
bad index doesn't result in writing over random memory.
Change-Id: I29ed03b59df937e6f95fba44209a03db23613a8d
Reviewed-on: http://gerrit.openafs.org/5525
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
#include <afsconfig.h>
#include <afs/param.h>
+#include <assert.h>
#include <roken.h>
#include <afs/afsint.h>
void
fsstats_StartOp(struct fsstats *stats, int index)
{
+ assert(index >= 0 && index < FS_STATS_NUM_RPC_OPS);
stats->opP = &(afs_FullPerfStats.det.rpcOpTimes[index]);
FS_LOCK;
(stats->opP->numOps)++;
void
fsstats_StartXfer(struct fsstats *stats, int index)
{
+ assert(index >= 0 && index < FS_STATS_NUM_XFER_OPS);
FT_GetTimeOfDay(&stats->xferStartTime, NULL);
stats->xferP = &(afs_FullPerfStats.det.xferOpTimes[index]);
}