From: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Peter Rosin <peda@axentia.se>, linux-kernel@vger.kernel.org
Subject: Re: [RESEND PATCH] mux: mmio: Zero the allocated memory
Date: Tue, 17 Mar 2026 15:39:41 +0100 [thread overview]
Message-ID: <4e93db73-20d2-436c-b9e4-4b41e5c237fa@oss.qualcomm.com> (raw)
In-Reply-To: <2026031710-implicit-hungrily-3b47@gregkh>
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.
Best regards,
Krzysztof
next prev parent reply other threads:[~2026-03-17 14:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-17 12:48 Krzysztof Kozlowski
2026-03-17 13:33 ` Greg Kroah-Hartman
2026-03-17 14:39 ` Krzysztof Kozlowski [this message]
2026-03-17 14:42 ` Greg Kroah-Hartman
2026-03-17 15:15 ` Krzysztof Kozlowski
-- strict thread matches above, loose matches on Subject: below --
2026-03-01 14:17 Krzysztof Kozlowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4e93db73-20d2-436c-b9e4-4b41e5c237fa@oss.qualcomm.com \
--to=krzysztof.kozlowski@oss.qualcomm.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peda@axentia.se \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®