summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorBob Copeland <me@bobcopeland.com>2015-05-28 22:44:37 (GMT)
committerLinus Torvalds <torvalds@linux-foundation.org>2015-05-29 01:25:19 (GMT)
commit5a6b2b36a8249ec9dfb2a714acadad86d9cc0aee (patch)
treef3878e295f5eaa25ecee2925481e4c0d9182f5a0 /fs
parentc0345ee57d461343586b5e1e2f9c3c3766d07fe6 (diff)
downloadlinux-5a6b2b36a8249ec9dfb2a714acadad86d9cc0aee.tar.xz
omfs: fix potential integer overflow in allocator
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> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/omfs/bitmap.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/omfs/bitmap.c b/fs/omfs/bitmap.c
index 0822345..83f4e76 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);