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

2025-02-24 Thread Lukasz Luba
On 2/22/25 20:02, Ethan Carter Edwards wrote: We are trying to get rid of all multiplications from allocation functions to prevent integer overflows[1]. Here the multiplication is obviously safe, but using kcalloc() is more appropriate and improves readability. This patch has no effect on runt

Re: [PATCH] thermal: core: Move initial num_trips assignment before memcpy()

2024-02-28 Thread Lukasz Luba
On 2/28/24 17:48, Kees Cook wrote: On Wed, Feb 28, 2024 at 09:56:51AM -0700, Nathan Chancellor wrote: On Wed, Feb 28, 2024 at 08:41:07AM +, Lukasz Luba wrote: Hi Nathan and Kees, On 2/27/24 17:00, Kees Cook wrote: On Tue, Feb 27, 2024 at 05:47:44PM +0100, Daniel Lezcano wrote: Ok my

Re: [PATCH] thermal: core: Move initial num_trips assignment before memcpy()

2024-02-28 Thread Lukasz Luba
Hi Nathan and Kees, On 2/27/24 17:00, Kees Cook wrote: On Tue, Feb 27, 2024 at 05:47:44PM +0100, Daniel Lezcano wrote: Ok my misunderstanding was I thought sizeof() was calling _bdos under the hood, so when calling sizeof(flex_array), it was returning the computed size inferring from the __coun

Re: [PATCH] thermal: core: Move initial num_trips assignment before memcpy()

2024-02-27 Thread Lukasz Luba
Hi Nathan, On 2/27/24 00:54, Nathan Chancellor wrote: When booting a CONFIG_FORTIFY_SOURCE=y kernel compiled with a toolchain that supports __counted_by() (such as clang-18 and newer), there is a panic on boot: [2.913770] memcpy: detected buffer overflow: 72 byte write of buffer size 0