mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH v1] nvmem: bsec: Fix incorrect size calculation for PTA read
@ 2025-01-07 11:30 Oleksij Rempel
  2025-01-08 14:35 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Oleksij Rempel @ 2025-01-07 11:30 UTC (permalink / raw)
  To: barebox; +Cc: Oleksij Rempel

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




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v1] nvmem: bsec: Fix incorrect size calculation for PTA read
  2025-01-07 11:30 [PATCH v1] nvmem: bsec: Fix incorrect size calculation for PTA read Oleksij Rempel
@ 2025-01-08 14:35 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2025-01-08 14:35 UTC (permalink / raw)
  To: barebox, Oleksij Rempel


On Tue, 07 Jan 2025 12:30:47 +0100, Oleksij Rempel wrote:
> 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.
> 
> 

Applied, thanks!

[1/1] nvmem: bsec: Fix incorrect size calculation for PTA read
      https://git.pengutronix.de/cgit/barebox/commit/?id=06e9050f42fd (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-01-08 14:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-07 11:30 [PATCH v1] nvmem: bsec: Fix incorrect size calculation for PTA read Oleksij Rempel
2025-01-08 14:35 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox