Skip to content

Commit 54694f9

Browse files
authored
Merge pull request #10887 from night1rider/fix-benchmark
Clamp benchmark numBlocks to at least 1 so large block sizes still run.
2 parents 4ab0a87 + b4fa087 commit 54694f9

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

wolfcrypt/benchmark/benchmark.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17064,6 +17064,10 @@ void benchmark_configure(word32 block_size)
1706417064
/* must be greater than 0 */
1706517065
if (block_size > 0) {
1706617066
numBlocks = (int)((word32)numBlocks * bench_size / block_size);
17067+
/* integer division can truncate to 0 for large block sizes; keep at
17068+
* least one block so the algorithm actually runs. */
17069+
if (numBlocks < 1)
17070+
numBlocks = 1;
1706717071
bench_size = block_size;
1706817072
}
1706917073
}

0 commit comments

Comments
 (0)