[PATCH v1] nvmem: bsec: Fix incorrect size calculation for PTA read

Oleksij Rempel o.rempel at pengutronix.de
Tue Jan 7 03:30:47 PST 2025


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 at 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




More information about the barebox mailing list