X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=options.c;h=1219803a73a1e9880698aa8ecf387f1426e7bdba;hp=3b04ffae8c129a6828add9cd75a28a22f451b96c;hb=e078de4a1c4e27f1938db4656e4d7cb6f98a8e1c;hpb=a88c8c14172004a1b6518ca181fe7f60c64c2c1a diff --git a/options.c b/options.c index 3b04ffae..1219803a 100644 --- a/options.c +++ b/options.c @@ -805,7 +805,7 @@ static int str_verify_pattern_cb(void *data, const char *input) { struct thread_data *td = data; long off; - int i = 0, j = 0, len, k, base = 10; + int i = 0, j = 0, len, k, base = 10, pattern_length; char *loc1, *loc2; loc1 = strstr(input, "0x"); @@ -844,10 +844,23 @@ static int str_verify_pattern_cb(void *data, const char *input) * Fill the pattern all the way to the end. This greatly reduces * the number of memcpy's we have to do when verifying the IO. */ + pattern_length = i; while (i > 1 && i * 2 <= MAX_PATTERN_SIZE) { memcpy(&td->o.verify_pattern[i], &td->o.verify_pattern[0], i); i *= 2; } + + /* + * Fill remainder, if the pattern multiple ends up not being + * MAX_PATTERN_SIZE. + */ + while (i > 1 && i < MAX_PATTERN_SIZE) { + unsigned int b = min(pattern_length, MAX_PATTERN_SIZE - i); + + memcpy(&td->o.verify_pattern[i], &td->o.verify_pattern[0], b); + i += b; + } + if (i == 1) { /* * The code in verify_io_u_pattern assumes a single byte pattern