]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
padata: Honor the caller's alignment in case of chunk_size 0
authorKamlesh Gurudasani <kamlesh@ti.com>
Wed, 21 Aug 2024 21:02:52 +0000 (02:32 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Oct 2024 13:10:44 +0000 (15:10 +0200)
commite53934e365495577dda921f1fe53720eeeff2be0
tree11ed142005f2858150f4a73340dae43dede91d1b
parentb48560a5c3c24a3ec8a5172ab011b6955af9385d
padata: Honor the caller's alignment in case of chunk_size 0

[ Upstream commit 24cc57d8faaa4060fd58adf810b858fcfb71a02f ]

In the case where we are forcing the ps.chunk_size to be at least 1,
we are ignoring the caller's alignment.

Move the forcing of ps.chunk_size to be at least 1 before rounding it
up to caller's alignment, so that caller's alignment is honored.

While at it, use max() to force the ps.chunk_size to be at least 1 to
improve readability.

Fixes: 6d45e1c948a8 ("padata: Fix possible divide-by-0 panic in padata_mt_helper()")
Signed-off-by: Kamlesh Gurudasani <kamlesh@ti.com>
Acked-by:  Waiman Long <longman@redhat.com>
Acked-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/padata.c