From: Denis Arefev <arefev@swemel.ru>
To: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Richard Weinberger <richard@nod.at>,
Vignesh Raghavendra <vigneshr@ti.com>,
linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
lvc-project@linuxtesting.org
Subject: [PATCH] mtd: partitions: redboot: Added conversion of operands to a larger type
Date: Tue, 10 Sep 2024 13:11:33 +0300 [thread overview]
Message-ID: <20240910101133.18020-1-arefev@swemel.ru> (raw)
The value of an arithmetic expression directory * master->erasesize is
subject to overflow due to a failure to cast operands to a larger data
type before perfroming arithmetic
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Denis Arefev <arefev@swemel.ru>
---
drivers/mtd/parsers/redboot.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mtd/parsers/redboot.c b/drivers/mtd/parsers/redboot.c
index 3b55b676ca6b..c8f7e7b351d7 100644
--- a/drivers/mtd/parsers/redboot.c
+++ b/drivers/mtd/parsers/redboot.c
@@ -92,7 +92,7 @@ static int parse_redboot_partitions(struct mtd_info *master,
parse_redboot_of(master);
if (directory < 0) {
- offset = master->size + directory * master->erasesize;
+ offset = master->size + (unsigned long) directory * master->erasesize;
while (mtd_block_isbad(master, offset)) {
if (!offset) {
nogood:
--
2.25.1
next reply other threads:[~2024-09-10 10:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-10 10:11 Denis Arefev [this message]
2024-09-25 10:38 ` [lvc-project] " Alexey Khoroshilov
-- strict thread matches above, loose matches on Subject: below --
2024-03-15 9:37 Denis Arefev
2024-03-25 10:18 ` Miquel Raynal
2024-03-25 10:30 ` Andy Shevchenko
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=20240910101133.18020-1-arefev@swemel.ru \
--to=arefev@swemel.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=lvc-project@linuxtesting.org \
--cc=miquel.raynal@bootlin.com \
--cc=richard@nod.at \
--cc=vigneshr@ti.com \
/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®