Re: [PATCH v4?] thermal/debugfs: replace kzalloc() with kcalloc() in thermal_debug_tz_add()

From: Markus Elfring
Date: Sun Feb 23 2025 - 05:11:56 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



> ---
> drivers/thermal/thermal_debugfs.c | 2 +-


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/drivers/thermal/thermal_debugfs.c
> @@ -876,7 +876,7 @@ void thermal_debug_tz_add(struct thermal_zone_device *tz)
>
> tz_dbg->tz = tz;
>
> - tz_dbg->trips_crossed = kzalloc(sizeof(int) * tz->num_trips, GFP_KERNEL);
> + tz_dbg->trips_crossed = kcalloc(tz->num_trips, sizeof(int), 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