Commit 303fd3e1 authored by Ard Biesheuvel's avatar Ard Biesheuvel Committed by Herbert Xu

crypto: tcrypt - avoid signed overflow in byte count

The signed long type used for printing the number of bytes processed in
tcrypt benchmarks limits the range to -/+ 2 GiB, which is not sufficient
to cover the performance of common accelerated ciphers such as AES-NI
when benchmarked with sec=1. So switch to u64 instead.

While at it, fix up a missing printk->pr_cont conversion in the AEAD
benchmark.
Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent ddf169a9
...@@ -199,8 +199,8 @@ static int test_mb_aead_jiffies(struct test_mb_aead_data *data, int enc, ...@@ -199,8 +199,8 @@ static int test_mb_aead_jiffies(struct test_mb_aead_data *data, int enc,
goto out; goto out;
} }
pr_cont("%d operations in %d seconds (%ld bytes)\n", pr_cont("%d operations in %d seconds (%llu bytes)\n",
bcount * num_mb, secs, (long)bcount * blen * num_mb); bcount * num_mb, secs, (u64)bcount * blen * num_mb);
out: out:
kfree(rc); kfree(rc);
...@@ -471,8 +471,8 @@ static int test_aead_jiffies(struct aead_request *req, int enc, ...@@ -471,8 +471,8 @@ static int test_aead_jiffies(struct aead_request *req, int enc,
return ret; return ret;
} }
printk("%d operations in %d seconds (%ld bytes)\n", pr_cont("%d operations in %d seconds (%llu bytes)\n",
bcount, secs, (long)bcount * blen); bcount, secs, (u64)bcount * blen);
return 0; return 0;
} }
...@@ -764,8 +764,8 @@ static int test_mb_ahash_jiffies(struct test_mb_ahash_data *data, int blen, ...@@ -764,8 +764,8 @@ static int test_mb_ahash_jiffies(struct test_mb_ahash_data *data, int blen,
goto out; goto out;
} }
pr_cont("%d operations in %d seconds (%ld bytes)\n", pr_cont("%d operations in %d seconds (%llu bytes)\n",
bcount * num_mb, secs, (long)bcount * blen * num_mb); bcount * num_mb, secs, (u64)bcount * blen * num_mb);
out: out:
kfree(rc); kfree(rc);
...@@ -1201,8 +1201,8 @@ static int test_mb_acipher_jiffies(struct test_mb_skcipher_data *data, int enc, ...@@ -1201,8 +1201,8 @@ static int test_mb_acipher_jiffies(struct test_mb_skcipher_data *data, int enc,
goto out; goto out;
} }
pr_cont("%d operations in %d seconds (%ld bytes)\n", pr_cont("%d operations in %d seconds (%llu bytes)\n",
bcount * num_mb, secs, (long)bcount * blen * num_mb); bcount * num_mb, secs, (u64)bcount * blen * num_mb);
out: out:
kfree(rc); kfree(rc);
...@@ -1441,8 +1441,8 @@ static int test_acipher_jiffies(struct skcipher_request *req, int enc, ...@@ -1441,8 +1441,8 @@ static int test_acipher_jiffies(struct skcipher_request *req, int enc,
return ret; return ret;
} }
pr_cont("%d operations in %d seconds (%ld bytes)\n", pr_cont("%d operations in %d seconds (%llu bytes)\n",
bcount, secs, (long)bcount * blen); bcount, secs, (u64)bcount * blen);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment