Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Waiman Long <longman@redhat.com>
Cc: steffen.klassert@secunet.com, daniel.m.jordan@oracle.com,
	akpm@linux-foundation.org, linux-crypto@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] padata: Fix possible divide-by-0 panic in padata_mt_helper()
Date: Sun, 11 Aug 2024 11:13:23 +0800	[thread overview]
Message-ID: <ZrgsU-1PdxvUVMOW@gondor.apana.org.au> (raw)
In-Reply-To: <91d29649-ca88-4f6c-bf1d-19e49c9555df@redhat.com>

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@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

  reply	other threads:[~2024-08-11  3:13 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-06 17:46 [PATCH] padata: Fix possible divide-by-0 panic in padata_mt_helper() Waiman Long
2024-08-10  4:05 ` Herbert Xu
2024-08-11  1:30   ` Waiman Long
2024-08-11  1:45     ` Herbert Xu
2024-08-11  3:11       ` Waiman Long
2024-08-11  3:13         ` Herbert Xu [this message]
2024-08-11  3:27           ` Waiman Long
2024-08-11  3:41             ` Herbert Xu
     [not found]               ` <c5cc5ea9-1135-4ac6-a38f-652ed07dae17@redhat.com>
2024-08-17  7:12                 ` Herbert Xu
2024-08-19 22:29                   ` Daniel Jordan
2024-08-20  0:07                     ` Waiman Long
2024-08-20  4:06                     ` Herbert Xu
2024-08-20 21:24                       ` Daniel Jordan
2024-08-21  8:10                         ` [EXTERNAL] " Kamlesh Gurudasani
2024-08-21 21:10                           ` Kamlesh Gurudasani
2024-08-23  0:45                             ` Daniel Jordan
2024-08-10 17:44 ` Kamlesh Gurudasani
2024-08-11  3:33   ` Waiman Long
2024-08-11  5:44     ` Kamlesh Gurudasani
2024-08-13 18:28       ` Waiman Long

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZrgsU-1PdxvUVMOW@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=akpm@linux-foundation.org \
    --cc=daniel.m.jordan@oracle.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=steffen.klassert@secunet.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox