From: Bob Copeland <me@bobcopeland.com>
To: akpm@linux-foundation.org
Cc: linux-fsdevel@vger.kernel.org, Bob Copeland <me@bobcopeland.com>
Subject: [PATCH 4/4] omfs: fix potential integer overflow in allocator
Date: Mon, 18 May 2015 07:34:38 -0400 [thread overview]
Message-ID: <1431948878-3756-5-git-send-email-me@bobcopeland.com> (raw)
In-Reply-To: <1431948878-3756-1-git-send-email-me@bobcopeland.com>
Both 'i' and 'bits_per_entry' are signed integers but the result
is a u64 block number. Cast i to u64 to avoid truncation on
32-bit targets.
Found by Coverity (CID 200679).
Signed-off-by: Bob Copeland <me@bobcopeland.com>
---
fs/omfs/bitmap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/omfs/bitmap.c b/fs/omfs/bitmap.c
index 082234581d05..83f4e76511c2 100644
--- a/fs/omfs/bitmap.c
+++ b/fs/omfs/bitmap.c
@@ -159,7 +159,7 @@ int omfs_allocate_range(struct super_block *sb,
goto out;
found:
- *return_block = i * bits_per_entry + bit;
+ *return_block = (u64) i * bits_per_entry + bit;
*return_size = run;
ret = set_run(sb, i, bits_per_entry, bit, run, 1);
--
2.1.4
prev parent reply other threads:[~2015-05-18 11:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-18 11:34 [PATCH 0/4] OMFS fixes Bob Copeland
2015-05-18 11:34 ` [PATCH 1/4] fs, omfs: add NULL terminator in the end up the token list Bob Copeland
2015-05-18 11:34 ` [PATCH 2/4] omfs: set error return when d_make_root() fails Bob Copeland
2015-05-18 11:34 ` [PATCH 3/4] omfs: fix sign confusion for bitmap loop counter Bob Copeland
2015-05-18 11:34 ` Bob Copeland [this message]
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=1431948878-3756-5-git-send-email-me@bobcopeland.com \
--to=me@bobcopeland.com \
--cc=akpm@linux-foundation.org \
--cc=linux-fsdevel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).