Unverified Commit 0512e86d authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!11295 padata: Fix possible divide-by-0 panic in padata_mt_helper()

parents da6dfc5d 066a788f
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -521,6 +521,13 @@ void __init padata_do_multithreaded(struct padata_mt_job *job)
	ps.chunk_size = max(ps.chunk_size, job->min_chunk);
	ps.chunk_size = roundup(ps.chunk_size, job->align);

	/*
	 * chunk_size can be 0 if the caller sets min_chunk to 0. So force it
	 * to at least 1 to prevent divide-by-0 panic in padata_mt_helper().`
	 */
	if (!ps.chunk_size)
		ps.chunk_size = 1U;

	list_for_each_entry(pw, &works, pw_list)
		queue_work(system_unbound_wq, &pw->pw_work);