Re: [RESEND PATCH] mux: mmio: Zero the allocated memory
From: Greg Kroah-Hartman
Date: Tue Mar 17 2026 - 10:51:08 EST
On Tue, Mar 17, 2026 at 03:39:41PM +0100, Krzysztof Kozlowski wrote:
> On 17/03/2026 14:33, Greg Kroah-Hartman wrote:
> > On Tue, Mar 17, 2026 at 01:48:27PM +0100, Krzysztof Kozlowski wrote:
> >> Zero the allocated memory in probe() for fields and states for increased
> >> code safety and to match expected Linux coding style.
> >
> > What "style"? I'm all for zeroing out memory to start with, but as this
>
> That style ^^^ that we expect zero'ed memory :).
>
> Also, memory-allocation.rst says:
>
> "And, to be on the safe side it's best to use routines that set memory
> to zero, like kzalloc()."
>
> So the style/preference is actually documented.
>
> > has lived for so long without this, are you sure it's still needed? Are
> > there uninitialized fields in here that we are now properly
> > initializing?
>
> Yes. The second allocation is for "hardware_states" which does not
> receive initialization in the probe, but first assignment is in
> suspend() callback.
>
> Zeroing the first allocation for "fields" is rather style or convention,
> because the probe assigns it further in the probe. However if the driver
> exists probe via error path, these bits would remain random heap data,
> which most likely does not matter.
>
> I can expand commit msg with above.
A changed changelog text would be great, thanks.
And who is supposed to take this, me?
thanks,
greg k-h