summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2016-03-15 09:48:25 -0600
committerJens Axboe <axboe@fb.com>2016-03-15 09:48:25 -0600
commit4205998f8be13752f9857ef6e28b6c7f86a3c769 (patch)
tree41d468eb979982cfccc2da3a78683f2dfefa0ef3
parent5f2f35697b1559cc4fff47c7c94cb983e6f2a460 (diff)
downloadfio-4205998f8be13752f9857ef6e28b6c7f86a3c769.tar.gz
Revert "options: move pattern_fmt_desc where we need it"
This reverts commit 5f3bd0fd67254e3750681f0700a0cc162faee500. We do need it to be globally reachable, otherwise we assign a pointer to an on-stack structure. This causes the pattern filling to read garbage, and segfault. Signed-off-by: Jens Axboe <axboe@fb.com>
-rw-r--r--options.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/options.c b/options.c
index 7075d84d..062abb4e 100644
--- a/options.c
+++ b/options.c
@@ -20,6 +20,14 @@
char client_sockaddr_str[INET6_ADDRSTRLEN] = { 0 };
+struct pattern_fmt_desc fmt_desc[] = {
+ {
+ .fmt = "%o",
+ .len = FIELD_SIZE(struct io_u *, offset),
+ .paste = paste_blockoff
+ }
+};
+
/*
* Check if mmap/mmaphuge has a :/foo/bar/file at the end. If so, return that.
*/
@@ -1184,20 +1192,13 @@ static int str_dedupe_cb(void *data, unsigned long long *il)
static int str_verify_pattern_cb(void *data, const char *input)
{
- struct pattern_fmt_desc fmt_desc[] = {
- {
- .fmt = "%o",
- .len = FIELD_SIZE(struct io_u *, offset),
- .paste = paste_blockoff
- }
- };
struct thread_data *td = data;
int ret;
td->o.verify_fmt_sz = ARRAY_SIZE(td->o.verify_fmt);
ret = parse_and_fill_pattern(input, strlen(input), td->o.verify_pattern,
- MAX_PATTERN_SIZE, fmt_desc, sizeof(fmt_desc),
- td->o.verify_fmt, &td->o.verify_fmt_sz);
+ MAX_PATTERN_SIZE, fmt_desc, sizeof(fmt_desc),
+ td->o.verify_fmt, &td->o.verify_fmt_sz);
if (ret < 0)
return 1;