[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZrgsU-1PdxvUVMOW@gondor.apana.org.au>
Date: Sun, 11 Aug 2024 11:13:23 +0800
From: Herbert Xu <herbert@...dor.apana.org.au>
To: Waiman Long <longman@...hat.com>
Cc: steffen.klassert@...unet.com, daniel.m.jordan@...cle.com,
akpm@...ux-foundation.org, linux-crypto@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] padata: Fix possible divide-by-0 panic in
padata_mt_helper()
On Sat, Aug 10, 2024 at 11:11:07PM -0400, Waiman Long wrote:
>
> > Unless I'm missing something chunk_size cannot be zero before the
> > division because that's the first thing we check upon entry into
> > this function.
>
> chunk_size is initialized as
>
> ps.chunk_size = job->size / (ps.nworks * load_balance_factor);
>
> chunk_size will be 0 if job->size < (ps.nworks * load_balance_factor). If
> min_chunk is 0, chunk_size will remain 0.
That's why I was suggesting that you replace the division by
DIV_ROUND_UP. That should ensure that ps.chunk_size is not zero.
Cheers,
--
Email: Herbert Xu <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Powered by blists - more mailing lists