From: Thorsten Blum <blum@kernel.org>
To: Madhavan Srinivasan <maddy@linux.ibm.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Nicholas Piggin <npiggin@gmail.com>,
"Christophe Leroy (CS GROUP)" <chleroy@kernel.org>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Paul Mackerras <paulus@ozlabs.org>
Cc: Thorsten Blum <blum@kernel.org>, linuxppc-dev@lists.ozlabs.org
Subject: [PATCH] macintosh/windfarm: Zero-initialize cached fan value
Date: Wed, 25 Nov 2026 19:37:10 +0100 [thread overview]
Message-ID: <20261125183712.312766-2-blum@kernel.org> (raw)
smu_fan_create() allocates the control with kmalloc_obj(), which leaves
fct->value uninitialized. Once the control is registered, reading the
fan control via sysfs and smu_fan_get() before the first call to
smu_fan_set() can therefore expose uninitialized heap data.
Use kzalloc_obj() to zero-initialize the control instead.
Note that smu_fan_get() returns the cached value set by smu_fan_set()
without querying the SMU. The initial value of 0 is thus only a
placeholder and does not indicate that the fan is stopped.
Fixes: 75722d3992f5 ("[PATCH] ppc64: Thermal control for SMU based machines")
Signed-off-by: Thorsten Blum <blum@kernel.org>
---
drivers/macintosh/windfarm_smu_controls.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/macintosh/windfarm_smu_controls.c b/drivers/macintosh/windfarm_smu_controls.c
index 671ff959bf06..2f4dc0e2be40 100644
--- a/drivers/macintosh/windfarm_smu_controls.c
+++ b/drivers/macintosh/windfarm_smu_controls.c
@@ -149,7 +149,7 @@ static struct smu_fan_control *smu_fan_create(struct device_node *node,
const u32 *reg;
const char *l;
- fct = kmalloc_obj(struct smu_fan_control);
+ fct = kzalloc_obj(*fct);
if (fct == NULL)
return NULL;
fct->ctrl.ops = &smu_fan_ops;
reply other threads:[~2026-11-25 18:37 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261125183712.312766-2-blum@kernel.org \
--to=blum@kernel.org \
--cc=benh@kernel.crashing.org \
--cc=chleroy@kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=paulus@ozlabs.org \
/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