mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] nvmem: fix possible integer overflow in nintendo_otp_reg_read()
@ 2022-07-08  6:53 Hangyu Hua
  0 siblings, 0 replies; only message in thread
From: Hangyu Hua @ 2022-07-08  6:53 UTC (permalink / raw)
  To: srinivas.kandagatla; +Cc: linux-kernel, Hangyu Hua

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@gmail.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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-07-08  6:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-08  6:53 [PATCH] nvmem: fix possible integer overflow in nintendo_otp_reg_read() Hangyu Hua

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

all inboxes | Powered by JetHome®