Re: [PATCH] crypto: tcrypt: clamp num_mb to avoid divide-by-zero

From: Herbert Xu

Date: Sat Mar 14 2026 - 01:11:58 EST


On Mon, Mar 02, 2026 at 03:59:14PM -0800, Saeed Mirzamohammadi wrote:
> 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@xxxxxxxxxx>
> ---
> crypto/tcrypt.c | 5 +++++
> 1 file changed, 5 insertions(+)

Patch applied. Thanks.
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt