From: Hangyu Hua <hbh25y@gmail.com>
To: srinivas.kandagatla@linaro.org
Cc: linux-kernel@vger.kernel.org, Hangyu Hua <hbh25y@gmail.com>
Subject: [PATCH] nvmem: fix possible integer overflow in nintendo_otp_reg_read()
Date: Fri, 8 Jul 2022 14:53:46 +0800 [thread overview]
Message-ID: <20220708065346.30727-1-hbh25y@gmail.com> (raw)
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
reply other threads:[~2022-07-08 6:54 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20220708065346.30727-1-hbh25y@gmail.com \
--to=hbh25y@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=srinivas.kandagatla@linaro.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
all inboxes | Powered by JetHome®