Re: [PATCH v3?] sched/topology: replace kzalloc() with kcalloc() in sched_init_numa()

From: Markus Elfring
Date: Sun Feb 23 2025 - 05:30:53 EST



> We are trying to get rid of all multiplications from allocation
> functions to prevent integer overflows[1]. …

Is an imperative wording more desirable for such a change description?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.14-rc3#n94



> ---
> kernel/sched/topology.c | 4 ++--


How do you think about to improve your version management?
https://lore.kernel.org/all/?q=%22This+looks+like+a+new+version+of+a+previously+submitted+patch%22
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.14-rc3#n780



> +++ b/kernel/sched/topology.c
> @@ -1918,7 +1918,7 @@ void sched_init_numa(int offline_node)
> */
> sched_domains_numa_levels = 0;
>
> - masks = kzalloc(sizeof(void *) * nr_levels, GFP_KERNEL);
> + masks = kcalloc(nr_levels, sizeof(void *), GFP_KERNEL);


See also:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?h=v6.14-rc3#n941

Regards,
Markus