From: Jennifer Berringer <jberring@redhat.com>
To: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
Sebastian Reichel <sre@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Maxime Ripard <mripard@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
Jennifer Berringer <jberring@redhat.com>
Subject: [PATCH v2 3/3] power: reset: nvmem-reboot-mode: fix write for small cells
Date: Thu, 24 Oct 2024 11:40:50 -0400 [thread overview]
Message-ID: <20241024154050.3245228-4-jberring@redhat.com> (raw)
In-Reply-To: <20241024154050.3245228-1-jberring@redhat.com>
Some devices, such as Qualcomm sa8775p, have an nvmem reboot mode cell
that is smaller than 32 bits, which resulted in
nvmem_reboot_mode_write() failing. Using nvmem_cell_write_variable_u32()
fixes this by writing only the least-significant byte of the magic value
when the size specified in device tree is only one byte.
Signed-off-by: Jennifer Berringer <jberring@redhat.com>
---
drivers/power/reset/nvmem-reboot-mode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/power/reset/nvmem-reboot-mode.c b/drivers/power/reset/nvmem-reboot-mode.c
index 41530b70cfc4..b52eb879d1c1 100644
--- a/drivers/power/reset/nvmem-reboot-mode.c
+++ b/drivers/power/reset/nvmem-reboot-mode.c
@@ -24,7 +24,7 @@ static int nvmem_reboot_mode_write(struct reboot_mode_driver *reboot,
nvmem_rbm = container_of(reboot, struct nvmem_reboot_mode, reboot);
- ret = nvmem_cell_write(nvmem_rbm->cell, &magic, sizeof(magic));
+ ret = nvmem_cell_write_variable_u32(nvmem_rbm->cell, magic);
if (ret < 0)
dev_err(reboot->dev, "update reboot mode bits failed\n");
--
2.46.2
prev parent reply other threads:[~2024-10-24 15:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-24 15:40 [PATCH v2 0/3] nvmem: fix out-of-bounds write Jennifer Berringer
2024-10-24 15:40 ` [PATCH v2 1/3] nvmem: core: improve range check for nvmem_cell_write() Jennifer Berringer
2024-10-29 17:55 ` Srinivas Kandagatla
2024-10-29 21:31 ` Jennifer Berringer
2024-10-30 11:43 ` Srinivas Kandagatla
2024-10-24 15:40 ` [PATCH v2 2/3] nvmem: core: add nvmem_cell_write_variable_u32() Jennifer Berringer
2024-10-24 15:40 ` Jennifer Berringer [this message]
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=20241024154050.3245228-4-jberring@redhat.com \
--to=jberring@redhat.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mripard@kernel.org \
--cc=sre@kernel.org \
--cc=srinivas.kandagatla@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.