Re: [PATCH v3] thermal/debugfs: change kzalloc to kcalloc
Markus Elfring <[email protected]> Sun, 9 Feb 2025 13:04:00 +0100
| Newsgroups | com.openwall.lists.kernel-hardening,org.kernel.vger.linux-hardening,org.kernel.vger.linux-kernel,org.kernel.vger.linux-pm |
|---|---|
| Message-ID | <[email protected]> |
> We are replacing any instances of kzalloc(size * count, ...) with > kcalloc(count, size, ...) due to risk of overflow [1]. * See also: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/= Documentation/process/submitting-patches.rst?h=3Dv6.13#n94 * Would you like to improve the summary phrase another bit? =E2=80=A6 > +++ b/drivers/thermal/thermal_debugfs.c > @@ -876,7 +876,7 @@ void thermal_debug_tz_add(struct thermal_zone_device= *tz) > > tz_dbg->tz =3D tz; > > - tz_dbg->trips_crossed =3D kzalloc(sizeof(int) * tz->num_trips, GFP_KER= NEL); > + tz_dbg->trips_crossed =3D kcalloc(tz->num_trips, sizeof(int), GFP_KERN= EL); =E2=80=A6 See also: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Do= cumentation/process/coding-style.rst?h=3Dv6.13#n941 Regards, Markus