[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <0e014581-bb98-43c8-8170-2556ac974657@web.de>
Date: Sun, 9 Feb 2025 13:04:00 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: Ethan Carter Edwards <ethan@...ancedwards.com>,
kernel-hardening@...ts.openwall.com, linux-hardening@...r.kernel.org,
linux-pm@...r.kernel.org, "Rafael J. Wysocki" <rafael@...nel.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
Daniel Lezcano <daniel.lezcano@...aro.org>
Subject: Re: [PATCH v3] thermal/debugfs: change kzalloc to kcalloc
> 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=v6.13#n94
* Would you like to improve the summary phrase another bit?
…
> +++ 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.13#n941
Regards,
Markus
Powered by blists - more mailing lists