Skip to content

Commit

Permalink
omfs: fix potential integer overflow in allocator
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
bcopeland authored and torvalds committed May 29, 2015
1 parent c0345ee commit 5a6b2b3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/omfs/bitmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 5a6b2b3

Please sign in to comment.