[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20220708065346.30727-1-hbh25y@gmail.com>
Date: Fri, 8 Jul 2022 14:53:46 +0800
From: Hangyu Hua <hbh25y@...il.com>
To: srinivas.kandagatla@...aro.org
Cc: linux-kernel@...r.kernel.org, Hangyu Hua <hbh25y@...il.com>
Subject: [PATCH] nvmem: fix possible integer overflow in nintendo_otp_reg_read()
bytes of type size_t is passed to words of type int in
nintendo_otp_reg_read. This can lead to integer overflow.
Signed-off-by: Hangyu Hua <hbh25y@...il.com>
---
drivers/nvmem/nintendo-otp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/nvmem/nintendo-otp.c b/drivers/nvmem/nintendo-otp.c
index 33961b17f9f1..eb614c31a6b4 100644
--- a/drivers/nvmem/nintendo-otp.c
+++ b/drivers/nvmem/nintendo-otp.c
@@ -50,7 +50,7 @@ static int nintendo_otp_reg_read(void *context,
{
struct nintendo_otp_priv *priv = context;
u32 *val = _val;
- int words = bytes / WORD_SIZE;
+ size_t words = bytes / WORD_SIZE;
u32 bank, addr;
while (words--) {
--
2.25.1
Powered by blists - more mailing lists