Skip to content

Commit ed51ffe

Browse files
ardbiesheuvelgregkh
authored andcommitted
crypto: tcrypt - avoid signed overflow in byte count
[ Upstream commit 303fd3e ] 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: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent bb5e204 commit ed51ffe

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

‎crypto/tcrypt.c‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,8 @@ static int test_mb_aead_jiffies(struct test_mb_aead_data *data, int enc,
199199
goto out;
200200
}
201201

202-
pr_cont("%d operations in %d seconds (%ld bytes)\n",
203-
bcount * num_mb, secs, (long)bcount * blen * num_mb);
202+
pr_cont("%d operations in %d seconds (%llu bytes)\n",
203+
bcount * num_mb, secs, (u64)bcount * blen * num_mb);
204204

205205
out:
206206
kfree(rc);
@@ -469,8 +469,8 @@ static int test_aead_jiffies(struct aead_request *req, int enc,
469469
return ret;
470470
}
471471

472-
printk("%d operations in %d seconds (%ld bytes)\n",
473-
bcount, secs, (long)bcount * blen);
472+
pr_cont("%d operations in %d seconds (%llu bytes)\n",
473+
bcount, secs, (u64)bcount * blen);
474474
return 0;
475475
}
476476

@@ -760,8 +760,8 @@ static int test_mb_ahash_jiffies(struct test_mb_ahash_data *data, int blen,
760760
goto out;
761761
}
762762

763-
pr_cont("%d operations in %d seconds (%ld bytes)\n",
764-
bcount * num_mb, secs, (long)bcount * blen * num_mb);
763+
pr_cont("%d operations in %d seconds (%llu bytes)\n",
764+
bcount * num_mb, secs, (u64)bcount * blen * num_mb);
765765

766766
out:
767767
kfree(rc);
@@ -1197,8 +1197,8 @@ static int test_mb_acipher_jiffies(struct test_mb_skcipher_data *data, int enc,
11971197
goto out;
11981198
}
11991199

1200-
pr_cont("%d operations in %d seconds (%ld bytes)\n",
1201-
bcount * num_mb, secs, (long)bcount * blen * num_mb);
1200+
pr_cont("%d operations in %d seconds (%llu bytes)\n",
1201+
bcount * num_mb, secs, (u64)bcount * blen * num_mb);
12021202

12031203
out:
12041204
kfree(rc);
@@ -1435,8 +1435,8 @@ static int test_acipher_jiffies(struct skcipher_request *req, int enc,
14351435
return ret;
14361436
}
14371437

1438-
pr_cont("%d operations in %d seconds (%ld bytes)\n",
1439-
bcount, secs, (long)bcount * blen);
1438+
pr_cont("%d operations in %d seconds (%llu bytes)\n",
1439+
bcount, secs, (u64)bcount * blen);
14401440
return 0;
14411441
}
14421442

0 commit comments

Comments
 (0)