From: Ankit Kumar Date: Fri, 21 Oct 2022 06:49:00 +0000 (+0530) Subject: stat: fix segfault with fio option --bandwidth-log X-Git-Tag: fio-3.33~11 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=d72244761b2230fbb2d6eaec59cdedd3ea651d4f;p=fio.git stat: fix segfault with fio option --bandwidth-log The log_params for aggregate read, write and trim only specify log type. As a result the io_log doesn't have the relevant thread_data structure. With fio option --bandwidth-log this results in segmentation fault. Add a check and use DEF_LOG_ENTRIES for such case. Fixes: 0a852a50 ("fio: Introduce the log_entries option") Signed-off-by: Ankit Kumar [vkf: added Fixes tag, lightly edited commit message] Signed-off-by: Vincent Fu --- diff --git a/stat.c b/stat.c index 949af5ed..b963973a 100644 --- a/stat.c +++ b/stat.c @@ -2870,7 +2870,10 @@ static struct io_logs *get_new_log(struct io_log *iolog) * forever */ if (!iolog->cur_log_max) { - new_samples = iolog->td->o.log_entries; + if (iolog->td) + new_samples = iolog->td->o.log_entries; + else + new_samples = DEF_LOG_ENTRIES; } else { new_samples = iolog->cur_log_max * 2; if (new_samples > MAX_LOG_ENTRIES)