mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Oleksij Rempel <o.rempel@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Oleksij Rempel <o.rempel@pengutronix.de>
Subject: [PATCH v1] nvmem: bsec: Fix incorrect size calculation for PTA read
Date: Tue,  7 Jan 2025 12:30:47 +0100	[thread overview]
Message-ID: <20250107113047.1231520-1-o.rempel@pengutronix.de> (raw)

Correct the size parameter in stm32_bsec_pta_read() to use sizeof(*val)
instead of sizeof(val). The previous implementation incorrectly
calculated the size of the pointer instead of the pointed-to value,
potentially causing incorrect behavior during the read operation.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
 drivers/nvmem/bsec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvmem/bsec.c b/drivers/nvmem/bsec.c
index 22e30c6c2e82..3fa73488f9f7 100644
--- a/drivers/nvmem/bsec.c
+++ b/drivers/nvmem/bsec.c
@@ -153,7 +153,7 @@ static int stm32_bsec_pta_read(void *context, unsigned int offset, unsigned int
 {
 	struct bsec_priv *priv = context;
 
-	return stm32_bsec_optee_ta_read(priv->ctx, offset, val, sizeof(val));
+	return stm32_bsec_optee_ta_read(priv->ctx, offset, val, sizeof(*val));
 }
 
 static int stm32_bsec_pta_write(void *context, unsigned int offset, unsigned int val)
-- 
2.39.5




             reply	other threads:[~2025-01-07 11:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-07 11:30 Oleksij Rempel [this message]
2025-01-08 14:35 ` Sascha Hauer

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=20250107113047.1231520-1-o.rempel@pengutronix.de \
    --to=o.rempel@pengutronix.de \
    --cc=barebox@lists.infradead.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