]> git.ipfire.org Git - thirdparty/linux.git/commit
crypto: tcrypt - clamp num_mb to avoid divide-by-zero
authorSaeed Mirzamohammadi <saeed.mirzamohammadi@oracle.com>
Mon, 2 Mar 2026 23:59:14 +0000 (15:59 -0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Sat, 14 Mar 2026 05:03:19 +0000 (14:03 +0900)
commit32e76e3757e89f370bf2ac8dba8aeb133071834e
tree543161d873304d3e5632c5910b4be43da8b12eae
parent3ac949881396361b6462a717f6cbbd97f368af02
crypto: tcrypt - clamp num_mb to avoid divide-by-zero

Passing num_mb=0 to the multibuffer speed tests leaves test_mb_aead_cycles()
and test_mb_acipher_cycles() dividing by (8 * num_mb). With sec=0 (the
default), the module prints "1 operation in ..." and hits a divide-by-zero
fault.

Force num_mb to at least 1 during module init and warn the caller so the
warm-up loop and the final report stay well-defined.

To reproduce:
sudo modprobe tcrypt mode=600 num_mb=0

Signed-off-by: Saeed Mirzamohammadi <saeed.mirzamohammadi@oracle.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/tcrypt.c