From: Jens Axboe Date: Mon, 3 Oct 2011 10:21:25 +0000 (+0200) Subject: Allocate thread_stat name arrays statically X-Git-Tag: fio-1.99~56 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=f6bb5b88614073878cbbd2666a1553481720faee Allocate thread_stat name arrays statically Signed-off-by: Jens Axboe --- diff --git a/fio.h b/fio.h index d540645f..1d3a9d47 100644 --- a/fio.h +++ b/fio.h @@ -170,15 +170,17 @@ enum { #define FIO_IO_U_LIST_MAX_LEN 20 /* The size of the default and user-specified list of percentiles */ -#define MAX_PATTERN_SIZE 512 +#define MAX_PATTERN_SIZE 512 +#define FIO_JOBNAME_SIZE 128 +#define FIO_VERROR_SIZE 128 struct thread_stat { - char *name; - char *verror; + char name[FIO_JOBNAME_SIZE]; + char verror[FIO_VERROR_SIZE]; int32_t error; int32_t groupid; uint32_t pid; - char *description; + char description[FIO_JOBNAME_SIZE]; uint32_t members; /* @@ -409,8 +411,6 @@ struct thread_options { unsigned int userspace_libaio_reap; }; -#define FIO_VERROR_SIZE 128 - /* * This describes a single thread/process executing a fio job. */ diff --git a/stat.c b/stat.c index 4bae5767..564edf34 100644 --- a/stat.c +++ b/stat.c @@ -727,8 +727,9 @@ void show_run_stats(void) /* * These are per-group shared already */ - ts->name = td->o.name; - ts->description = td->o.description; + strncpy(ts->name, td->o.name, FIO_JOBNAME_SIZE); + strncpy(ts->description, td->o.description, + FIO_JOBNAME_SIZE); ts->groupid = td->groupid; /* @@ -750,10 +751,10 @@ void show_run_stats(void) if (!td->error && td->o.continue_on_error && td->first_error) { ts->error = td->first_error; - ts->verror = td->verror; + strcpy(ts->verror, td->verror); } else if (td->error) { ts->error = td->error; - ts->verror = td->verror; + strcpy(ts->verror, td->verror); } }