diff options
-rw-r--r-- | kernel/padata.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/padata.c b/kernel/padata.c index 222bccd0c96b..d51bbc76b227 100644 --- a/kernel/padata.c +++ b/kernel/padata.c @@ -513,9 +513,12 @@ void __init padata_do_multithreaded(struct padata_mt_job *job) * thread function. Load balance large jobs between threads by * increasing the number of chunks, guarantee at least the minimum * chunk size from the caller, and honor the caller's alignment. + * Ensure chunk_size is at least 1 to prevent divide-by-0 + * panic in padata_mt_helper(). */ ps.chunk_size = job->size / (ps.nworks * load_balance_factor); ps.chunk_size = max(ps.chunk_size, job->min_chunk); + ps.chunk_size = max(ps.chunk_size, 1ul); ps.chunk_size = roundup(ps.chunk_size, job->align); list_for_each_entry(pw, &works, pw_list) |